From 9b4dc0401f15d7a843bb780614d541adc6e54735 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 9 Jun 2025 18:29:00 +0530 Subject: [PATCH] Update docs/en/reference/default-theme-last-updated.md --- .../reference/default-theme-last-updated.md | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/en/reference/default-theme-last-updated.md b/docs/en/reference/default-theme-last-updated.md index 2f7d0ad0..94566c51 100644 --- a/docs/en/reference/default-theme-last-updated.md +++ b/docs/en/reference/default-theme-last-updated.md @@ -3,7 +3,26 @@ The update time of the last content will be displayed in the lower right corner of the page. To enable it, add `lastUpdated` options to your config. ::: tip -To display the last updated time, at least one Git commit is required, as we retrieve the most recent Git commit timestamp by default. Additionally, if all file update times consistently match the latest project commit (rather than reflecting actual file modifications), please verify whether your file history is incomplete (e.g., due to using Git's shallow clone mode). +VitePress displays the "last updated" time using the timestamp of the most recent Git commit for each file. To enable this, the Markdown file must be committed to Git. + +Internally, VitePress runs `git log -1 --pretty="%ai"` on each file to retrieve its timestamp. If all pages show the same update time, it's likely due to shallow cloning (common in CI environments), which limits Git history. + +To fix this in **GitHub Actions**, use the following in your workflow: + +```yaml{4} +- name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 +``` + +Other CI/CD platforms have similar settings. + +If such options aren't available, you can prepend the `docs:build` command in your `package.json` with a manual fetch: + +```json +"docs:build": "git fetch --unshallow && vitepress build docs" +``` ::: ## Site-Level Config