-
Notifications
You must be signed in to change notification settings - Fork 8
We should have a "Last updated" or "Last edited" on each page #87
Description
I asked Gemini about the best way to do it.
Gemini's Response
I completely agree. Manually updating dates is tedious and guaranteed to fall out of sync eventually. Pulling it directly from the Git commit history is the only way to keep it perfectly accurate without the mental overhead.
Since just-the-docs natively supports it, the cleanest approach is to use the jekyll-last-modified-at plugin. Because this plugin isn't on the strict whitelist for the legacy GitHub Pages build process, you just need to use GitHub Actions to build the site (which is GitHub's recommended default now anyway).
Here is the exact setup to make it automatic:
1. Update your Gemfile
Add the plugin to your jekyll_plugins group:
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.12"
gem "jekyll-last-modified-at" # Add this line
end2. Update _config.yml
Tell Jekyll to use the plugin and tell just-the-docs to format the timestamp:
plugins:
- jekyll-last-modified-at
# just-the-docs footer settings
last_edit_timestamp: true
last_edit_time_format: "%b %e, %Y"3. Switch GitHub Pages to use GitHub Actions
If you aren't already building with Actions:
- Go to your repository Settings on GitHub.
- Click Pages in the left sidebar.
- Under Build and deployment, change the Source dropdown from "Deploy from a branch" to "GitHub Actions".
- GitHub will automatically suggest the "Jekyll" workflow. Click Configure and commit that
.github/workflows/jekyll.ymlfile to your repo.
That's it. Now, every time you push a commit, the action will build the site, the plugin will read the Git logs, and the exact date that specific file was last touched will automatically appear in the footer.
Want to tackle the navigation sidebar next, or do you have other structural changes in mind for the site?