From 24e9d533dc0f2ec781bdbc73d3d2995fb5f4b014 Mon Sep 17 00:00:00 2001 From: Kian Date: Wed, 8 Jan 2025 14:49:06 +0000 Subject: [PATCH] [Docs Site] Fix fetch-depth and last updated on pages with updated fm (#19070) --- .github/workflows/publish-preview.yml | 2 ++ .github/workflows/publish-production.yml | 2 ++ astro.config.ts | 1 + src/components/overrides/LastUpdated.astro | 12 ++++++++++++ 4 files changed, 17 insertions(+) create mode 100644 src/components/overrides/LastUpdated.astro diff --git a/.github/workflows/publish-preview.yml b/.github/workflows/publish-preview.yml index 07d872d560300d..ba5a7e3616fe15 100644 --- a/.github/workflows/publish-preview.yml +++ b/.github/workflows/publish-preview.yml @@ -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 diff --git a/.github/workflows/publish-production.yml b/.github/workflows/publish-production.yml index e40e382f8565b8..a8fb2ee1c61d3a 100644 --- a/.github/workflows/publish-production.yml +++ b/.github/workflows/publish-production.yml @@ -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 diff --git a/astro.config.ts b/astro.config.ts index b8aaaedef38256..03b004c6b7be47 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -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", diff --git a/src/components/overrides/LastUpdated.astro b/src/components/overrides/LastUpdated.astro new file mode 100644 index 00000000000000..d271e81e82dcf1 --- /dev/null +++ b/src/components/overrides/LastUpdated.astro @@ -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; +} +--- + +