Topic summary
A developer is working on displaying blog posts filtered by specific tags on a Shopify store landing page. They shared their current Liquid code implementation that loops through blog articles and displays images and titles.
Current Issue:
- Need to show blog posts based on a particular tag (example tag name: “peels”)
- The existing code displays all articles without tag-based filtering
Solution Provided:
Another user suggested implementing a tag loop structure:
- First, check if the article has tags using
{% if article.tags.size > 0 %} - Loop through tags with
{% for tag in article.tags %} - Create tag-filtered links using the format:
{{ blog.url }}/tagged/{{ tag | handle }} - Add “read more” links to individual articles
Status: The discussion appears to be ongoing, with the initial solution framework provided but implementation details may need further refinement.
{%- for article in section.settings.blog1.articles -%}
{%- endfor -%}
-------------------i want to show blog post based on tag example tag name: "sleep"
first of all you need to list all the tags using loop.
{% if article.tags.size > 0 %}
{% for tag in article.tags %}
{% if article.tags.size > 0 %}
{% for tag in article.tags %}
{{ tag }}
{% break %}
{% endfor %}
{% endif %}
{{ article.title }}
read more
{% endfor %}
{% endif %}