2012-12-27 18 views
0

我試圖編輯blog.liquid,以便在特定的博客列表上,它上面有一個自定義圖形。Shopify顯示如果Blog.Handle是X的博客列表

事情與此類似:

<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,並根據哪一個,如何引用該特定句柄,以便該圖像僅顯示在該圖像上。

希望我解釋清楚。經過一段時間的搜索,還沒有發現任何有用的東西。

回答

1

這應該是:

{% if blog.handle == 'new-years-revolution' %} 
<p class="alignCenter">**[custom code here]**</p> 
{% endif %} 
+0

完美,謝謝:) –

相關問題