跨不同页面使用液体标签
Use of liquid tags across different pages
有没有办法在post A中调出post B的描述(在它的front matter中说明)?
liquid 标签 {{page.description}}
仅调用 post A 的描述。有没有办法包含 url 之类的东西,从而在不同的文件中使用 liquid 标签?
或者有更好的方法吗?
不幸的是,前题变量只能从该文件中访问。
Between these triple-dashed lines, you can set predefined variables (see below for a reference) or even create custom ones of your own. These variables will then be available to you to access using Liquid tags both further down in the file and also in any layouts or includes that the page or post in question relies on.
但是,您可以通过遍历每个 post 并使用 if 语句仅包含您想要的内容来解决 post 秒的问题。
{% for post in site.posts %}
{% if post.title == "Desired Post Title" %}
{{ post.description }}
{% endif %}
{% endfor %}
有没有办法在post A中调出post B的描述(在它的front matter中说明)?
liquid 标签 {{page.description}}
仅调用 post A 的描述。有没有办法包含 url 之类的东西,从而在不同的文件中使用 liquid 标签?
或者有更好的方法吗?
不幸的是,前题变量只能从该文件中访问。
Between these triple-dashed lines, you can set predefined variables (see below for a reference) or even create custom ones of your own. These variables will then be available to you to access using Liquid tags both further down in the file and also in any layouts or includes that the page or post in question relies on.
但是,您可以通过遍历每个 post 并使用 if 语句仅包含您想要的内容来解决 post 秒的问题。
{% for post in site.posts %}
{% if post.title == "Desired Post Title" %}
{{ post.description }}
{% endif %}
{% endfor %}