Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 访问集合文档中的自定义front matter变量_Html_Jekyll_Liquid - Fatal编程技术网

Html 访问集合文档中的自定义front matter变量

Html 访问集合文档中的自定义front matter变量,html,jekyll,liquid,Html,Jekyll,Liquid,我的收藏中有一份Jekyll收藏文档编码: --- title: 'iOS iConify' rawname: iosiconify image: {{site.img}}/z-iosiconify.png layout: post link: https://iosiconify.github.io/ --- Hi! 我试图在html页面上呈现集合编码中的所有文档,我有以下代码: {% for post in site.coding %} <tr id="{{ post.

我的收藏中有一份Jekyll收藏文档
编码

---
title: 'iOS iConify'
rawname: iosiconify
image: {{site.img}}/z-iosiconify.png
layout: post
link: https://iosiconify.github.io/
---

Hi!
我试图在html页面上呈现集合
编码
中的所有文档,我有以下代码:

  {% for post in site.coding %}
    <tr id="{{ post.rawname }}-desktop">
        <td id="left">
            <a href="{{ post.link }}" target="blank" id="{{ post.rawname }}-desktop-a">
                <img src="{{ post.image }}">
            </a>
        </td>
        <td id="right">
            <h2>{{ post.title }}</h2>
            <h4>{{ post.content }}</h4>
        </td>
    </tr>
    {% endfor %}

你知道为什么定制的front matter变量都不起作用吗?我怎样才能让它们起作用?

front matter中有一个错误,它阻止Jekyll正确处理它,只显示内容

这一行
image:{{site.img}/z-iosiconify.png
应该是
image:z-iosiconify.png

然后,当显示文档prepend
site.img
时,如
{{post.image | prepend:site.img}
。例如:

{% for post in site.coding %}
<tr id="{{ post.rawname }}-desktop">
    <td id="left">
        <a href="{{ post.link }}" target="blank" id="{{ post.rawname }}-desktop-a">
            <img src="{{ post.image | prepend: site.img }}">
        </a>
    </td>
    <td id="right">
        <h2>{{ post.title }}</h2>
        <h4>{{ post.content }}</h4>
    </td>
</tr>
{% endfor %}
{%for post in site.coding%}
{{post.title}}
{{post.content}}
{%endfor%}
{% for post in site.coding %}
<tr id="{{ post.rawname }}-desktop">
    <td id="left">
        <a href="{{ post.link }}" target="blank" id="{{ post.rawname }}-desktop-a">
            <img src="{{ post.image | prepend: site.img }}">
        </a>
    </td>
    <td id="right">
        <h2>{{ post.title }}</h2>
        <h4>{{ post.content }}</h4>
    </td>
</tr>
{% endfor %}