Would it be possible to filter blog posts by the year of the published date? Or would we need to create a tag for each year and apply it to the post?
Thanks,
Terry McMillan
Would it be possible to filter blog posts by the year of the published date? Or would we need to create a tag for each year and apply it to the post?
Thanks,
Terry McMillan
Hi @tmcmillan99, you could do this:
{% for content in contents %}
{% if content.publish_date|datetimeformat('%Y') == '2022' %}
...
{% endif %}
{% endfor %}
Thanks so much for the suggestion. After finding a similar post, I knew I needed something close to this but wasn’t quite sure of the syntax. I will give this a try.
Thanks,
Terry