I'm working with Webby and am looking for some clarification. Can I define attributes like title
or author
in my layout?
views:
286answers:
2
A:
I've never used it but the tutorial here:
http://webby.rubyforge.org/tutorial/
Makes it look like the answer to your question is "yes". Specifically I'm looking under the "Making Changes" header on that page.
John
2008-08-23 05:14:19
What you (and the tutorial) mention is valid for the content pages. It is not true for the layouts, however.
Tomas Sedovic
2010-03-22 23:39:21
+1
A:
Not really. The layout has access to the page attributes rather than the other way.
The easiest way to do what you want is to populate the SITE.page_defaults hash in your site's Rakefile (probably build.rake). Add something like the following:
SITE.page_defaults['title'] = "My awesome title"
SITE.page_defaults['author'] = "Shazbug"
SITE.page_defaults['is_mando_awesome'] = "very yes"
You can now access those hash members in your template:
Written by <%= @page.author %>
You can find more info about Webby's page default stuff on the Google Group, specifically here:
http://groups.google.com/group/webby-forum/browse_thread/thread/f3dc1f4187959634/c30d7883705f6218?lnk=gst&q=SITE#c30d7883705f6218
mando
2008-08-25 15:25:59