0

我正在尝试编辑 blog.liquid 以便在特定的博客列表中,其上方有一个自定义图形。

与此类似的东西:

<div id="page-header">
    <h2 id="page-title">{{ blog.title }}</h2>
</div>
{% if blog.new-years-revolution %}
<p class="alignCenter">**[custom code here]**
</p>
{% endif %}

{% for article in blog.articles  %}

<h3 class="blog">
<a href="{{article.url}}">{{ article.title | escape }}</a></h3>

    {% if article.excerpt.size > 0 %}
        {{ article.excerpt }}
    {% else %}
        <p>{{ article.content | strip_html | truncate: 800 }}</p>
    {% endif %}


{% endfor %}

基本上我不希望它出现在任何其他博客上,只是这个特定的。所以一个基本的 if 语句说“如果在这个博客上,显示这个”。我不确定是使用 blog.id 还是 blog.handle,并且取决于哪个,如何引用该特定句柄,以便该图像仅显示在该句柄上。

希望我解释得足够清楚。谷歌搜索了一段时间,还没有发现任何有用的东西。

4

1 回答 1

1

那应该是:

{% if blog.handle == 'new-years-revolution' %}
<p class="alignCenter">**[custom code here]**</p>
{% endif %}
于 2012-12-27T20:14:15.663 回答