【发布时间】:2017-06-27 14:10:59
【问题描述】:
我有以下文件:
_layouts/twoPointLayout.html
---
layout: documentationLayout
---
{% assign col = site.interfaceServer | where:"neededTopCollectionItem", page.topCollectionItem | sort: "order" %}
<ol class="breadcrumb">
<li><a href="{{ col[0].url }}">{{ col[0].title }}</a></li>
<li class="active">{{ page.title }}</li>
</ol>
<h3>{{ col[0].order }}.{{ page.order }} {{ page.title }}</h3>
{{ content }}
someFile.md
---
title: "Some title"
identifier: hints
order: 3
orderPagination: 24
layout: twoPointLayout
topCollectionItem: xyz
neededTopCollectionItem: xyz_hints
---
{% assign items = site.interfaceServer | where:"topCollectionItem", "xdt-documentation_hints" | sort: "order" %}
{{ page.col[0].order }} // This doesn`t work
{% for item in items %}
<h4 id="{{ item.identifier }}"><a href="{{ item.url }}">{{ col[0].order }}.{{ page.order }}.{{ item.order }} {{ item.title }}</a></h4>
{% endfor %}
在布局twoPointLayout.html 中有一个变量声明col。现在我需要在页面someFile.md中使用这个具有相同内容的变量。
我已经使用page.col[0].order 访问该变量,但它不起作用。
如何访问变量?
【问题讨论】:
标签: html variables jekyll liquid