Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
Hi all, I have been using Brooklyn template for my store and also started to use a blog. On my blog page, tags are not showing so I couldn't find have can show them.. you can check from http://www.ceremonist.com/blogs/news ;. I am not a developer and the page goes down and down when I add a new blog post so it doesn't make any sence for visitors. Here is what written in my blog.liquid. Is there anyone can help me about this?
Thank you
<!-- /templates/blog.liquid -->
{% paginate blog.articles by 5 %}
<div class="grid">
<div class="grid__item large--five-sixths push--large--one-twelfth">
<header class="section-header text-center">
<h1>
{% if current_tags %}
{{ blog.title | link_to: blog.url }} — {{ current_tags.first }}
{% else %}
{{ blog.title }}
{% endif %}
<a href="{{ shop.url }}{{ blog.url }}.atom" class="icon-fallback-text rss-link">
<span class="icon icon-rss" aria-hidden="true"></span>
<span class="fallback-text">RSS</span>
</a>
</h1>
<hr class="hr--small">
</header>
{% for article in blog.articles %}
{% assign article_content = article.excerpt_or_content %}
{% comment %}
Scrape article content and pull first image to become featured
assigns featured_image_src to first images src
assigns featured_image to image tag containing featured_image_src
assigns article_content to article_content without the first image
{% endcomment %}
{% if article_content contains '<img' %}
{% assign featured_image_src = article_content | split: 'src="' %}
{% assign featured_image_src = featured_image_src[1] | split: '"' | first %}
{% capture featured_image %}
{% comment %}TODO: can we make sure an 'original' size is never loaded?{% endcomment %}
{{ featured_image_src | img_tag: article.title }}
{% endcapture %}
{% assign article_content = article_content | replace: featured_image_src, '' | replace: 'src=""', 'style="display: none;"' %}
{% else %}
{% assign featured_image = false %}
{% endif %}
<article class="grid small--text-center article">
{% if featured_image %}
<div class="grid__item">
<a class="article--featured-image" href="{{ article.url }}">
{{ featured_image }}
</a>
</div>
{% endif %}
<div class="grid__item large--two-tenths push--large--one-tenth">
<time datetime="{{ article.published_at | date: '%Y-%m-%d' }}" class="date">{{ article.published_at | date: format: 'month_day_year' }}</time>
<hr class="hr--small hr--left small--hide">
</div>
<div class="grid__item large--six-tenths push--large--one-tenth">
<h3><a href="{{ article.url }}">{{ article.title }}</a></h3>
<div class="rte rte--indented-images">
{{ article_content | strip_html | truncatewords: 120 }}
</div>
<p>
<a href="{{ article.url }}" class="text-link">{{ 'blogs.article.read_more' | t }} →</a>
</p>
{% if article.tags.size > 0 %}
<ul class="tags tags--article inline-list">
{% include 'tags-article' %}
</ul>
{% endif %}
</div>
</article>
{% unless forloop.last %}<hr class="hr--clear">{% endunless %}
{% endfor %}
{% if paginate.pages > 1 %}
<div class="pagination">
{{ paginate | default_pagination | replace: '« Previous', '←' | replace: 'Next »', '→' }}
</div>
{% endif %}
</div>
</div>
{% endpaginate %}
Hello Ozlem, Ben here - your Shopify Guru!
The Brooklyn theme puts tags at the bottom of the article see here:
If you want tags listed at the top like they are on colletion pages you can place this code below the </h1> tag on line 19 of your blog.liquid file:
{% if blog.all_tags.size > 0 %}
{% comment %}
To provide a 'catch-all' link at the top of the list,
check against the collection.handle, product type, and vendor.
{% endcomment %}
<ul class="tags tags--collection inline-list">
<li{% unless current_tags %} class="tag--active"{% endunless %}>
{% comment %}
Good for /collections/all collection and regular collections
{% endcomment %}
{% for tag in blog.all_tags %}
{% if current_tags contains tag %}
<li class="tag--active">
{{ tag | link_to_remove_tag: tag }}
</li>
{% else %}
<li>
{% comment %}
Use link_to_add_tag if you want to allow filtering
by multiple tags
{% endcomment %}
{{ tag | link_to_tag: tag }}
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
I hope this helps! Feel free to reach out if you have any further questions 🙂
Cheers,
Ben C - Shopify Guru
Support@Shopify.com
Benjamin | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog