Last modified time
With BrainDB
- Install BrainDB
- Then you can access modification date, like this
With Starlight
Starlight already has this feature, but the value is not exposed in the content collection. For example, if you set:
You would see Last updated:
on the page, but at the same time, page.data.lastUpdated
would be undefined
.
With Remark plugin
-
Create remark plugin
-
Configure Astro
-
You may need to adjust content schema
But the value is accessible only after render
:
Based on: Astro recipes β
Tips
Github actions
If you build your site with Github Actions, you need to use fetch-depth: 0
Further improvements
Use the last modification date (for content pages) in:
- schema.org microdata
- sitemap β (
lastmod
) - in the Sidebar to show βnewβ badge