Skip to content

Instantly share code, notes, and snippets.

@joe-dempsey
Last active July 19, 2023 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joe-dempsey/796996a7277123ceffdc9bd2333984c2 to your computer and use it in GitHub Desktop.
Save joe-dempsey/796996a7277123ceffdc9bd2333984c2 to your computer and use it in GitHub Desktop.
Use custom layout for tagged posts with Shopify.
{% comment %}
we need a way to loop through tags to display a different blog template for tagged posts as to the general overview/archive page
doesn't seem like there's an easy way to do this but there is.
there are tow options:
{% endcomment %}
{% if current_tags %}...{% else %}...{% endif %}
{% comment %}or{% endcomment %}
{% assign counter = 0 %}
{% for tag in blog.tags %}
{% assign counter = counter | plus: 1 %}
{% endfor %}
{% if counter == 1 %}
{% comment %}we're on a tag page{% endcomment %}
{% else %}
{% comment %}we're on an archive page{% endcomment %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment