-
Notifications
You must be signed in to change notification settings - Fork 16
Feat: Enable per-page git timestamps for sitemap lastmod and footer updates #298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: makeplane/developer-docs
Length of output: 15537
🌐 Web query:
VitePress lastUpdated sitemap git history shallow clone build behavior💡 Result:
In VitePress, the lastUpdated feature and sitemap generation rely on Git commit history to determine the timestamp of files [1][2]. When a build environment performs a shallow clone (which is the default in many CI/CD services like GitHub Actions, Netlify, or Cloudflare Pages), only the most recent commit is typically available [3][4][1]. Impact of Shallow Clone: Because VitePress internally executes git log -1 --pretty="%at" on each file to retrieve its timestamp [1][5], a shallow clone limits the history available to Git [3][1]. Consequently, if the history is insufficient to identify the actual last modification commit for each individual file, many or all pages may incorrectly display the same timestamp (often the date of the most recent commit in the repository) [3][4][1]. Resolution for CI/CD Builds: To ensure accurate timestamps for lastUpdated and sitemap generation, you must configure your CI/CD environment to fetch the full Git history: 1. GitHub Actions: Update your checkout step to include fetch-depth: 0 [1][6]. - name: Checkout uses: actions/checkout@v5 with: fetch-depth: 0 2. Other CI/CD Environments: If your provider does not support configuring the clone depth, you can prepend the build command in your package.json with a manual fetch to unshallow the repository [4][1]: "docs:build": "git fetch --unshallow && vitepress build docs" Sitemap Behavior: VitePress uses the lastUpdated timestamp for the sitemap's lastmod attribute [7][2]. As of recent updates, VitePress respects any custom lastUpdated value defined in a file's frontmatter; if that is absent, it falls back to the timestamp retrieved from the Git log [8][2][9]. Ensuring a full Git history as described above is necessary for the sitemap's lastmod values to reflect the true historical modification dates of your files [1][2].
Citations:
Don’t ignore a failed unshallow fetch at
package.json:8—|| trueleaves the build running with shallow history, so VitePress can publish incorrectlastUpdated/sitemaplastmodvalues. Make the build fail if history stays shallow, or explicitly disable those timestamps in that fallback path.🤖 Prompt for AI Agents
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: makeplane/developer-docs
Length of output: 253
🏁 Script executed:
Repository: makeplane/developer-docs
Length of output: 4342
🏁 Script executed:
Repository: makeplane/developer-docs
Length of output: 50381
package.json:8 — Keep the build preflight cross-platform.
trueisn’t available in Windows package-script shells, so a failedgit fetch --unshallowstopspnpm buildbeforevitepress build docsruns. Use a Node-based no-op fallback instead.🤖 Prompt for AI Agents