# Blog Post Filter by Year

**URL:** <https://community.hubspot.com/t/blog-post-filter-by-year/58344>\
**Category:** CMS Development\
**Tags:** design-manager\
**Created:** [June 3, 2022, 8:01pm UTC](https://community.hubspot.com/t/blog-post-filter-by-year/58344 "2022-06-03T20:01:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmcmillan99](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tmcmillan99/32/93181_2.png) [@tmcmillan99](https://community.hubspot.com/u/tmcmillan99)\
**Post date:** [June 3, 2022, 8:01pm UTC](https://community.hubspot.com/t/blog-post-filter-by-year/58344/1 "2022-06-03T20:01:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![piersg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/piersg/32/99782_2.png) [@piersg](https://community.hubspot.com/u/piersg)\
**Post date:** [June 6, 2022, 12:09pm UTC](https://community.hubspot.com/t/blog-post-filter-by-year/58344/2 "2022-06-06T12:09:12Z")

</div>

Hi @tmcmillan99, you could do this:

```lia-code-sample
{% for content in contents %}
 {% if content.publish_date|datetimeformat('%Y') == '2022' %}
 ...
 {% endif %}
{% endfor %}

```

---

<div class="post-metadata">

**Author:** ![tmcmillan99](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tmcmillan99/32/93181_2.png) [@tmcmillan99](https://community.hubspot.com/u/tmcmillan99)\
**Post date:** [June 6, 2022, 1:16pm UTC](https://community.hubspot.com/t/blog-post-filter-by-year/58344/3 "2022-06-06T13:16:54Z")

</div>

@piersg

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
