Inserting a timestamp in content

Is there a way to insert a timestamp in content, that will capture the build date/time? I tried using {{ time.Now | timeFormat "15:04" }}, and it didn’t work.

Check the function name:

https://gohugo.io/functions/time/format/#article

Maybe I didn’t explain myself well. I want to insert time in a post content. For example:

---
title: Test
date: 2025-05-23T14:23:58-04:00
---
This is a test. The time now is {{ time.Now | time.Format “15:04” }}.

It isn’t working for me, is that possible?

Create a shortcode:

https://gohugo.io/templates/shortcode/#insert-year

Or an inline shortcode:

https://gohugo.io/content-management/shortcodes/#inline

2 Likes

Thank you very much, exactly what I wanted!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.