middlemanのmetaタグ設定(haml)

手順1:frontmatterにmetaタグの内容を入れる

f:id:tenyo_ten:20160412124722g:plain

手順2:layoutテンプレートで設定

f:id:tenyo_ten:20160412122107g:plain

hamlで書くとこうなります。

%meta{:content => current_page.data.keywords, :name => "keywords"}
%meta{:content => current_page.data.description, :name => "description"}
%title= current_page.data.title
%meta{:content => "= current_page.data.keywords", :name => "keywords"}
%meta{:content => "= current_page.data.description", :name => "description"}

↑ こう書くとハマるので注意。 erb見ながら書くとここでつまずく! ちょんちょんで囲むのと、=付けるのはやめよう。

追記

もう一個ハマッた ↓

%title= current_page.data.title

この「title」と「=」の間のスペースに注意! 絶対入れちゃダメ。見落としすぎてハマる。