Hello Shopify Community,
I am working on some custom collection pages and want to display a section of targeted blog posts that correspond to that collection type.
I have set up a custom metafield (article.metafields.custom.solution) for my blog posts that allows me to pick from a predetermined list of “tags” ( I couldn’t use the normal blog tags because I needed those to be different from the filter tag) which would allow me to filter the posts.
I’ve used the following code to display 3 blog posts containing the tag:
{% assign check = 1 %}
{%- for article in section.settings.blog.articles -%}
{%- if article.metafields.custom.solution.value contains blog_tag_filter and check < 4-%}
{% assign check = check | plus: 1 %}
{%- render ‘blog-post-card’, article: article, blog: section.settings.blog, show_category: section.settings.show_category, show_excerpt: section.settings.show_excerpt, show_read_more: section.settings.show_read_more, sizes: sizes -%}
{%- endif -%}
{%- endfor -%}
The issue is that some of the collection pages are only displaying one or two blog posts while others are displaying the maximum three posts, even though there are are at least three blog posts that have been tagged for the corresponding collection.
Any idea what would cause this to display less than three posts? Any insights would be appreciated.
The website is elementapothec.com. Here is one of the collection pages that is displaying less than three posts: