I would like to show the last 4 blog posts that have a specific tag. The following code will successfully render all the blog posts with a specific tag:
{%- for article in blog.articles -%}
{% if article.tags contains section.settings.article-tag %}
{%- render 'article-grid-item',
blog: blog,
article: article,
grid_item_width: 'medium-up--one-third',
per_row: '3',
image_size: section.settings.blog_image_size
-%}
{%endif%}
{%- endfor -%}
However… when I add a limit of 4, it only cycles through the last 4 blog posts and will return nothing if the last four blog posts do not contain the desired tag.
{%- for article in blog.articles limit:4 -%}
What can I do to cycle through all the blog posts until it finds the last 4 tagged with a specific tag?