-
I'm trying to include the date/time the dashboard was last generated. What's the best way of doing this? So far I've created a Python data loader to make a 1 row CSV import datetime
import sys
sys.stdout.buffer.write(b'generated\n')
sys.stdout.buffer.write(str(datetime.datetime.now().timestamp()).encode('utf-8')) And then accessing it in Javascript from a markdown file: const generated = await FileAttachment("./data/generated.csv").csv({typed: true}) And then outputting it in the file, for example: <p>Data pulled from source ${(new Date(generated[0].generated * 1000)).toLocaleString('en-GB', {dateStyle: 'full', timeStyle: 'long'})}</p> And it works, but it feels a touch manual/faffy. Is there a more concise/canonical way? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can display the build time with a footer defined as a function that returns something like |
Beta Was this translation helpful? Give feedback.
You can display the build time with a footer defined as a function that returns something like
built with Observable at ${Date.now()}
. For the data files build time (data loaders might have been run before the site was built, thanks to the cache), use the FileAttachment’s lastModified property.