I’m working in blog-template.liquid. I’m trying to show 13 articles on the first page of the blog with subsequent pages showing 12. My initial attempt was this:
{% if paginate.current_page > 1 %}
{% paginate blog.articles by 12 %}
{% else %}
{% paginate blog.articles by 13 %}
{% endif %}
// Output articles...
{% endpaginate %}
This doesn’t work because {% endpaginate %} must be paired with ‘paginate’ inside the if/else statement.
I’ve attempted the code below using variables but Shopify rejects the variable usage with 'Unknown tag ‘num_articles’. Is there any way to have this statement accept and transform a variable to an integer – or is there a different solution I’m not thinking of? I’m somewhat new to Shopify and Liquid.
{% assign num_articles = 13 %}
{% if paginate.current_page > 1 %}
{% num_articles = 12 %}
{% endif %}
{% paginate blog.articles by num_articles %}
// Output articles...
{% endpaginate %}