Crystal Groves
Crystal Groves

Reputation: 113

Shopify Display If Blog.Handle is X for blog listing

I am attempting to edit blog.liquid so that on a particular blogs listing, there is a customize graphic above it.

Something similar to this:

<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 %}

Essentially I don't want it to show up on any other blogs, just this particular one. So a basic if statement that says "if on this blog, show this". I'm not sure whether to use the blog.id or blog.handle, and depending on which one, how to reference that particular handle so that this image only shows up on that one.

Hopefully I'm explaining clearly enough. Been googling for a while and haven't found anything helpful yet.

Upvotes: 0

Views: 3591

Answers (1)

Jamie
Jamie

Reputation: 373

That should be:

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

Upvotes: 1

Related Questions