HubSpot CMS

Add Suffix to Blog Date


Created by: Jason Rosa



After receiving a minimum of 25 recommendations, an entry earns the "Community Approved" badge.

Please keep in mind, all entries are community created and may not be fully supported by HubSpot.

2 Recommendations

View on:


{% set day = content.publish_date_local_time.strftime('%e') %}
     {% if day >= 4 and day <= 20 %}
        {% set day = day + "th" %}
     {% elif day >= 24 and day <= 30 %}
        {% set day = day + "th" %}
     {% elif day == 1 or day == 21 or day == 31 %}
        {% set day = day + "st" %}
     {% elif day == 2 or day == 22 %}
        {% set day = day + "nd" %}
     {% elif day == 3 or day == 23 %}
        {% set day = day + "rd" %}
     {% endif %}
{{ content.publish_date_local_time.strftime('%B') }} <span class='day'>{{ day }}</span>, {{ content.publish_date_local_time.strftime('%Y') }}



Have Questions?

Ask technical questions in Slack.

HubSpot Developer Slack

Not a member yet? - join here

Add Suffix to Blog Date

Purpose: to add the suffix (e.g. the "th" in 13th) to the end of the number on a date in the blog tool


Add this snippet in the blog listing template HTML/blog post template HTML where you want your date to show. To edit the formatting of the month and year please reference the datetimeformat HubL filter here (

2 Recommendations

Jason Rosa


A web developer living in Portsmouth, New Hampshire and working for @HubSpot.

View Jason Rosa’s Gallery (3 Entries)

Other Open Source Projects

Browse all other open source projects

CrankShaft Framework

A modern framework for accelerating build times on the HubSpot CMS. Based on a modified Bootstrap 4 framework.

Lead developers: Jon McLaren

Developer Chrome Extension

Chrome/Chromium extension for HubSpot CMS Developers that adds a developer menu, dark theme and useful shortcuts to commonly used HubSpot query parameters, resources, and tools for making HubSpot Development easier and more enjoyable.

Lead developers: Jon McLaren , William Spiro , Gonzalo Torreras

VS Code HubL Language Extension

This extension enables super fast local development of CMS pages, and is a great compliment to using the new local HubL server. It contains comprehensive HubL tag, function, filter and expression test auto-complete snippets, as well as their documentation.

Lead developers: William Spiro

Not coding on HubSpot CMS yet?

We invite you to explore why thousands of developers LOVE coding with HubSpot!

Made with  by community members: