Last active
July 19, 2023 10:12
-
-
Save joe-dempsey/796996a7277123ceffdc9bd2333984c2 to your computer and use it in GitHub Desktop.
Use custom layout for tagged posts with Shopify.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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