[Docs Site] Fix fetch-depth and last updated on pages with updated fm (#19070)

This commit is contained in:
Kian 2025-01-08 14:49:06 +00:00 committed by GitHub
parent 27cf90bd40
commit 24e9d533dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 0 deletions

View file

@ -15,6 +15,8 @@ jobs:
name: Publish Preview
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22.x

View file

@ -11,6 +11,8 @@ jobs:
name: Publish Production
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22.x

View file

@ -152,6 +152,7 @@ export default defineConfig({
Footer: "./src/components/overrides/Footer.astro",
Head: "./src/components/overrides/Head.astro",
Hero: "./src/components/overrides/Hero.astro",
LastUpdated: "./src/components/overrides/LastUpdated.astro",
MarkdownContent: "./src/components/overrides/MarkdownContent.astro",
Sidebar: "./src/components/overrides/Sidebar.astro",
PageSidebar: "./src/components/overrides/PageSidebar.astro",

View file

@ -0,0 +1,12 @@
---
import type { Props } from "@astrojs/starlight/props";
import Default from "@astrojs/starlight/components/LastUpdated.astro";
// Disable lastUpdated in footer if `updated` is present,
// since this will show the date in PageTitle.astro instead.
if (Astro.props.entry.data.updated) {
Astro.props.lastUpdated = undefined;
}
---
<Default {...Astro.props} />