cloudhead/toto

Is there a way to set specific meta info on each page (not articles)

benjamincharity opened this issue · 1 comments

Setting meta desc etc on articles is incredibly simple. But as far as I can tell, the description pulled in on your layout file will be used on all other pages. Is there a way to pass a custom description on other pages such as an archive?

ixti commented

You can write a simple helper for this purposes, e.g. put this in your config.ru:

module Toto
  module Template
    attr_accessor :meta_desc
  end
end

then you'll be able to call:

meta_desc = <<-META
My page description
<<META

and have something like this in your layout:

<meta name="description" value="<%= meta_desc || 'Default one...' %>" />