Last active
October 5, 2023 19:54
-
-
Save kyleaparker/b9fd3e4f7532f9f19658 to your computer and use it in GitHub Desktop.
[Shopify] Display articles alphabetically
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
{% assign articles = blogs.news.articles | sort: 'title' %} | |
{% for article in articles %} | |
{{ article.title }}<br> | |
{% endfor %} |
Yeah, it's a really frustrating issue that still isn't fixed. 😬 Know it's a bit late, but here's one way to work around it:
{%- capture articleList -%}
{%- for article in blog.articles -%}{{ article.title | handleize }}{% unless forloop.last %},{% endunless %}{%- endfor -%}
{%- endcapture -%}
<style type="text/css">
/* List articles in alphabetical order */
{% for articleName in articleList %}
.location-{{ articleName }} {
order: {{ forloop.index }};
}
{% endfor %}
</style>
{% for article in blog.articles %}
<a class="location-{{ article.title | handleize }}" href="{{ article.url }}">
{{ article.title }}
</a>
{% endfor %}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Unfortunatelly, Shopify will not allow you to paginate that :(