Use git modified time for footer date in publishes #3959
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The "Updated" date in Techniques and Understanding page footers currently reflects the date the content was built, which will always be the same date across all files, and can be far more recent than the last time the file in question was actually directly changed.
In a couple of discussions, the idea was raised to instead reflect the last git modified time of each file. Fortunately, Eleventy 1.0 and later provides a built-in way to do this.
This PR configures Eleventy to populate its
page.date
value from git modified time when building with theWCAG_MODE
environment variable set to any truthy value (which is the case when using the Eleventy build system both for gh-pages and for the WAI site). In other cases (e.g. local dev), local modified time will be used instead to save time, as git modified time makes the build take significantly longer (around 10 seconds rather than 6).Note that I intentionally did not update the Copyright line in the footer to follow this logic; I presume that should be updated site-wide with each build.
A couple of caveats worth noting:
Also note that the Netlify preview will not reflect the changes on this branch, as it does not build with
WCAG_MODE
.Expand for a run-down of git modified dates as of the opening of this PR