Closed jikaczmarski closed 3 months ago
Reopened this issue. I want to find a way that the "Last Modified" tag reports the commit to the file as opposed to the most recent build. Otherwise all last modified dates are the same across the entire web book since it all gets rendered at the same time. @ianalexmac @eldobbins
Here is a way to add a modification date to the left sidebar that implies all the pages have the same date: https://github.com/quarto-dev/quarto-cli/discussions/6671
Would look like
For what it's worth, the timestamp is outputting GMT (?). I think this is just fine, but it would be great if we could say Mar 26, 2024 at 22:03 GMT
@ianalexmac I think that's a good idea. I'll look into normalizing the time zone and adding a time zone code.
make sure is consistent
https://quarto.org/docs/reference/dates.html#using-a-date-format. would need to install https://day.js.org/docs/en/plugin/timezone. dependent timezone plugin
Note: I think this plugin must already be installed because timezone has UTC mark on it.
Found someone with a similar problem who added something to the GitHub action so I copied that to see if it works.
Update: nope. didn't do what I wanted.
Tried another thing with R code. It reported the correct modifications times locally, but when pushed to the repo, it reported the time of the commit. That is because fix-timestamps.sh
is setting the file modification times to the commit time from the log. That wasn't what I was shooting for, so comment that out from the workflow.
Update: OK, without the "fix", the modification time on the page is whenRun actions/checkout@v4
in the Action happens. So the mod time is when the file gets copied to the gh-pages
branch. So now I see why using the git log time is maybe useful - because it would be the time when the last change was made and not the time of the copy ... if it was a different time for every file. But it isn't.
Update: Tried fix on local machine with echo
instead of touch
and the time printed for every file was different. So uncommented the section in the workflow to double check. Every file has the same time and that is the time when I committed the change to quarto_publish.yml
. So behavior conflicts.
Update: Tried specifying the main branch to get the commit time in the fix
script but every file still has the same time.
It is a git "feature". I made notes in https://github.com/acep-uaf/aetr-web-book-2024/wiki/File-modification-times
Every page has 2 dates now: Published
which is generated from Quarto/GitHub when it is rendered, and Modified
which is hardcoded in the front matter of each .qmd
file individually. The latter can be used to indicate if the data files change, or the plots, or some major bit of text revision. Modified
should not change for typo fixes or formatting adjustments.
Brittany asked for something that displays when the website was last edited (rendered). Since it is dynamic and is theoretically changing often, the reader should know how up-to-date it is.