Code
Created by: Jason Rosa
Tags:
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.
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') }}
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 (https://designers.hubspot.com/docs/hubl/hubl-supported-filters#datetimeformat).
A web developer living in Portsmouth, New Hampshire and working for @HubSpot.
View Jason Rosa’s Gallery (3 Entries)A modern framework for accelerating build times on the HubSpot CMS. Based on a modified Bootstrap 4 framework.
Lead developers: Jon McLaren
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
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
Find an entry with an issue, bug, or abuse?
Please complete the below information in detail and we will investigate.
Reporting as Luke Summerfield