我正在与 Webby 合作,并寻求一些说明。 我可以在布局中定义 title 或 author 等属性吗?
title
author
I'm working with Webby and am looking for some clarification. Can I define attributes like title or author in my layout?
并不真地。 布局可以访问页面属性,而不是其他方式。
实现您想要的操作的最简单方法是在站点的 Rakefile(可能是 build.rake)中填充 SITE.page_defaults 哈希值。 添加如下内容:
SITE.page_defaults['title'] = "My awesome title" SITE.page_defaults['author'] = "Shazbug" SITE.page_defaults['is_mando_awesome'] = "very yes"
您现在可以在模板中访问这些哈希成员:
Written by <%= @page.author %>
您可以在 Google 网上论坛上找到有关 Webby 页面默认内容的更多信息,特别是在这里:
http://groups.google.com/group/webby-forum/browse_thread/thread /f3dc1f4187959634/c30d7883705f6218?lnk=gst&q=SITE#c30d7883705f6218
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:
You can now access those hash members in your template:
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
我从未使用过它,但这里的教程:
使它看起来像你的问题的答案是“是的”。 具体来说,我正在该页面上的“进行更改”标题下查看。
I've never used it but the tutorial here:
Makes it look like the answer to your question is "yes". Specifically I'm looking under the "Making Changes" header on that page.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(2)
并不真地。 布局可以访问页面属性,而不是其他方式。
实现您想要的操作的最简单方法是在站点的 Rakefile(可能是 build.rake)中填充 SITE.page_defaults 哈希值。 添加如下内容:
您现在可以在模板中访问这些哈希成员:
您可以在 Google 网上论坛上找到有关 Webby 页面默认内容的更多信息,特别是在这里:
http://groups.google.com/group/webby-forum/browse_thread/thread /f3dc1f4187959634/c30d7883705f6218?lnk=gst&q=SITE#c30d7883705f6218
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:
You can now access those hash members in your template:
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
我从未使用过它,但这里的教程:
使它看起来像你的问题的答案是“是的”。 具体来说,我正在该页面上的“进行更改”标题下查看。
I've never used it but the tutorial here:
Makes it look like the answer to your question is "yes". Specifically I'm looking under the "Making Changes" header on that page.