Custom 'Updated' Time Stamp for Blog Posts

Hi!

I found this article on the subject but seems like the actual code snippet is missing from there. Does anybody have the snippet available for sharing?

https://blog.hubspot.com/customers/writing-a-custom-updated-timestamp-for-blog-posts

Thanks in advance!

Joel

Hi @jjokinen

Thank you for reaching out. I have reached out to the team for this missing part.

As for your question, wondering if some of our top experts would already have the answer - @Kevin-C @DanielSanchez @Gonzalo do you have any thoughts on that for @jjokinen ?

Thank you!

Best

Tiphaine

Hi @TitiCuisset,

Thanks! Did you hear anything back from the team?
And thanks @Gonzalo for the snippet! Would you use that in the exact same way as the article instructs?

If the time is important in your context then yes, you would want to customize the date format filter adding the time and follow the post to replace for the right timezone, otherwise I would say is not that important :slightly_smiling_face:

Hey @jjokinen

Thank you for your reply

The team is looking into it but I haven’t gotten an update just yet, I’ll share that here once I have!

Thank you

Best

Tiphaine

Hi @jjokinen

Apologies for the delay here. Got an update from the team, the snippet in the blog post would be:

{% set update_time = content.updated %}
{% set offset = <your offset> %}
{% set new_time = update_time + offset %}

Thank you!

Best

Tiphaine

If you are looking to display the last updated date instead of the published date on a post page you can use the following:

{{ content.updated|datetimeformat('%B %e, %Y') }}