ruby-on-rails – 如何在Jekyll中处理模板(布局)继承?

栏目: Ruby · 发布时间: 6年前

内容简介:是的,布局可以通过管道传输.在您的情况下,如果页面使用template1布局,则它是template1的内容.然后,template1的结果是默认的内容.翻译自:https://stackoverflow.com/questions/10422154/how-to-handle-template-layouts-inheritance-in-jekyll

我想要一个模板“_layouts / template1.html”扩展(Django风格)模板_layouts / default.html.

我把它作为YAML前面的事情放在_layouts / template1.html中

---
layout: default 
---
{{page.content}}

但显然它不能像我希望的那样工作(所有附加的标记都存在于template1.html中,但不是在default.html中不会渲染).看起来使用template1布局的文件纯粹扩展了default.html.

有没有办法在Jekyll中进行布局继承?

是的,布局可以通过管道传输.在您的情况下,如果页面使用template1布局,则它是template1的内容.然后,template1的结果是默认的内容.

翻译自:https://stackoverflow.com/questions/10422154/how-to-handle-template-layouts-inheritance-in-jekyll


以上所述就是小编给大家介绍的《ruby-on-rails – 如何在Jekyll中处理模板(布局)继承?》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Art of Computer Programming, Volume 2

The Art of Computer Programming, Volume 2

Knuth, Donald E. / Addison-Wesley Professional / 1997-11-04 / USD 79.99

Finally, after a wait of more than thirty-five years, the first part of Volume 4 is at last ready for publication. Check out the boxed set that brings together Volumes 1 - 4A in one elegant case, and ......一起来看看 《The Art of Computer Programming, Volume 2》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器