cloudhead / toto

the 10 second blog-engine for hackers
MIT License
1.48k stars 245 forks source link

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

Open benjamincharity opened 12 years ago

benjamincharity commented 12 years ago

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 12 years ago

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...' %>" />