发布于 2016-05-19 02:37:59
目前看来,只可能获得您正在查看的页面的页面。这可能不是你需要的。您可能需要pages列表中每个页面的页面。希望他们很快就能加入。不过,为了防止它对您有所帮助,我是这样获得当前正在浏览的页面的页面的:
{{#each breadcrumbs}}
{{#if @last}}
{{this.pageid}}
{{/if}}
{{/each}}我使用这个方法根据页面加载一个特定的样式表。我对config.json中的每个页面都有样式表的映射。
"settings": {
"page_stylesheets": {
"151": {"file_name": "my-custom-stylesheet.css"}
}我在“模板/布局/base.html”中添加了一个块:
{{#block "pageStyles"}} {{/block}}然后,在我的模板/page/page.html文件的顶部,我有以下内容:
{{#partial "pageStyles"}}
{{#each breadcrumbs}}
{{#if @last}}
{{#with (lookup ../../theme_settings.page_stylesheets this.pageid)}}
{{{stylesheet (concat 'assets/css/' this.file_name)}}}
{{/with}}
{{/if}}
{{/each}}
{{/partial}}https://stackoverflow.com/questions/37216548
复制相似问题