html 将变量传递给Jekyll中的包含

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 将变量传递给Jekyll中的包含相关的知识,希望对你有一定的参考价值。

{% include sidebar.html links=page.relatedpages %}

<!--
Now in sidebar.html you have access to the links variable through include.links. You can now use the contents of this variable like any other liquid variable, e.g.
-->

{% if include.links %}
  ...some code..
{% endif %}

<!--
You can pass in as many different variables as you like.
-->

{% include sidebar.html links=page.relatedpages title=page.title %}

<!--
You can pass in absolute values as well by surrounding the value with quotes.
-->

{% include sidebar.html links=page.relatedpages title='My awesome page' %}

<!--
If you pass in multiple values with the same name then they overwrite each other (i.e. only the last value will be available). In the example below only the value "title2" will be available for variable include.title in the sidebar.html include.
-->

{% include sidebar.html links=page.relatedpages title='title1' title='title2' %}

<!--
If you want to combine argument values or concatinate them you will need to first capture the value in a new variable and then pass that into the include. In the example below I create a new variable new_title and then pass it into the include.
-->

{% capture new_title %}Welcome to my page titled {{page.title}} have fun.{% endcapture %}

{% include sidebar.html links=page.relatedpages title=new_title %}

以上是关于html 将变量传递给Jekyll中的包含的主要内容,如果未能解决你的问题,请参考以下文章

Jekyll/Liquid - 如何将大块文本添加到 YAML 前端?

将变量传递给nodemailer中的html模板

将HTML表单变量传递给Django中的python函数

将变量传递给现代中继中的片段容器

将Javascript变量传递给laravel 5.3中的路由

将局部变量传递给嵌套的局部变量