2
在基於Haml的Padrino解決方案,我有一個application.haml
這樣的:選擇性地使用yield_content在Padrino application.haml模板
!!!
%html
%head
%title "blah"
%body
#header
= yield_content :headcontent
#container
...
對於:headcontent
,在我的頁面(如index.haml
)我有
- content_for :headcontent do
#headcontent
%h2= "Index header stuff"
#content
...
我想要做的是使內容頁面如index.haml
可以可選指定- content for :headcontent
。那就是我想application.haml
包含一些默認:headcontent
只有當頁面沒有做時纔會呈現- content for :headcontent
。
我如何做到這一點?