https://github.com/val-town/add-last-updated
Add lastUpdated to Astro Starlight frontmatter based on git information
https://github.com/val-town/add-last-updated
astro markdown starlight vfile
Last synced: about 1 year ago
JSON representation
Add lastUpdated to Astro Starlight frontmatter based on git information
- Host: GitHub
- URL: https://github.com/val-town/add-last-updated
- Owner: val-town
- Created: 2024-01-09T16:49:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-09T17:03:10.000Z (over 2 years ago)
- Last Synced: 2025-04-02T22:51:24.428Z (about 1 year ago)
- Topics: astro, markdown, starlight, vfile
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @valtown/add-last-updated
Another Markdown-related single-tasker script, provided
for folks who have the same problem or want another example
of how to use `vfile` and that ecosystem.
If you:
- Are using [Astro Starlight](https://starlight.astro.build/)
- And Cloudflare Pages or a similar static host that
uses [shallow git clones](https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/)
- And you want to show `lastUpdated` dates
Then you probably have incorrect lastUpdated dates,
because there isn't the git history to provide them. So
you'll need to use [lastUpdated](https://starlight.astro.build/reference/frontmatter/#lastupdated) in frontmatter.
This tool helps you make the transition.
## Example usage:
Assuming you are in your Astro Starlight docs directory,
run:
```sh
npx @valtown/add-last-updated src/content
```