CMS Development

jjokinen
Contributor

Custom 'Updated' Time Stamp for Blog Posts

SOLVE

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

1 Accepted solution
Gonzalo
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Custom 'Updated' Time Stamp for Blog Posts

SOLVE

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') }}

 

 

If this answer helps you to solve your questions please mark it as a solution.

Thank you,


Gonzalo Torreras

HubSpot freelance developer

hola@gonzalotorreras.com
www.gonzalotorreras.com
Schedule a meeting

View solution in original post

6 Replies 6
Gonzalo
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Custom 'Updated' Time Stamp for Blog Posts

SOLVE

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') }}

 

 

If this answer helps you to solve your questions please mark it as a solution.

Thank you,


Gonzalo Torreras

HubSpot freelance developer

hola@gonzalotorreras.com
www.gonzalotorreras.com
Schedule a meeting
TiphaineCuisset
Community Manager
Community Manager

Custom 'Updated' Time Stamp for Blog Posts

SOLVE

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


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


jjokinen
Contributor

Custom 'Updated' Time Stamp for Blog Posts

SOLVE

Hi @TiphaineCuisset,

 

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? 

TiphaineCuisset
Community Manager
Community Manager

Custom 'Updated' Time Stamp for Blog Posts

SOLVE

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


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


0 Upvotes
TiphaineCuisset
Community Manager
Community Manager

Custom 'Updated' Time Stamp for Blog Posts

SOLVE

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


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


Gonzalo
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Custom 'Updated' Time Stamp for Blog Posts

SOLVE

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 🙂

If this answer helps you to solve your questions please mark it as a solution.

Thank you,


Gonzalo Torreras

HubSpot freelance developer

hola@gonzalotorreras.com
www.gonzalotorreras.com
Schedule a meeting