Blot

Is there a template variable for the last build date that can be date string formatted?

My usecase is that I'm looking to put a last build date in the footer of my pages but I'm not sure that any of the date, formatDate, etc bits work outside of the entries loop. There's {{updated}} but I don't think can be formatted into a readable time string can it? It also didn't exist in the json I looked at when using the debug=true URL parameter. I tried {{dateStamp}} but it was empty. Other ideas? Can I "fake" it with something like {{#recentEntries.0}} and just pulling the first item I guess? (I don't think this is quite what I want but it might be the best I can do?)

Asked a year ago Edit
3 replies

I'm open to adding a template function to render this. The global {{updated}} date string just uses the updated timestamp of your most recent entry. As you wrote, you can display this like so:

{{#recentEntries}}
{{#first}}
{{#formatUpdated}}
Updated YYYY MM DD
{{/formatUpdated}}
{{/first}}
{{/recentEntries}}

However, it sounds like you want to display the last time the site was modified for any reason (could be a background sync, could be a template change, etc...). Is that correct?

At the moment, we store a {{cacheID}} property which is a timestamp that represents the last update of any sort to the site. This timestamp refreshes quite regularly and sometimes changes without you taking any direct action.

I'm open to adding a function to let you display the {{cacheID}} as a date in your preferred format, let me know.

a year ago Edit

Thanks for the follow up!

Yes my ideal would be something built from the cacheID timestamp that I can format using the current date format string language.

a year ago Edit

I have now changed the global {{updated}} property such that it returns the last build time of the site, and can be used as date formatting function, like so:

Built on {{#updated}}YYYY{{/updated}}

You can use any of the date tokens. This template variable is now in the docs. Please let me know if you have any questions about this or anything else.

a year ago Edit

Your reply