I want to display the most recent Tags from the latest blog Post on my home page (or limit it to perhaps 6).
My code so far shows every tag:
<div class="archive-tags">
{% for post in site.posts %}
{% if post.tags != empty %}
{% for tag in post.tags %}
<a href="{{site.baseurl}}/tags/#{{tag|slugify}}">{{ tag }}</a>
{% endfor %}
{% endif %}
{% endfor %}
</div>
And i'd like to know what markup to use to limit this or show only the most recent blog post tags.
Thanks for reading!
The answer to what i was looking for was a simple as adding limit: 1
.
The amended working code is now:
<div class="archive-tags">
{% for post in site.posts limit: 1 %}
{% if post.tags != empty %}
{% for tag in post.tags %}
<a href="{{site.baseurl}}/tags/#{{tag|slugify}}">{{ tag }}</a>
{% endfor %}
{% endif %}
{% endfor %}
Finished/desired result here: https://linksoftheweek.co.uk/