diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 0490caa4..9bd19935 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -4,6 +4,7 @@ export default defineConfig({ lang: 'en-US', title: 'VitePress', description: 'Vite & Vue powered static site generator.', + lastUpdated: true, themeConfig: { diff --git a/docs/config/app-configs.md b/docs/config/app-configs.md index 631cc347..3e3d4b0c 100644 --- a/docs/config/app-configs.md +++ b/docs/config/app-configs.md @@ -152,7 +152,7 @@ export default { - Type: `boolean` - Default: `false` -Use git commit to get the timestamp. Some themes may use it. +Use git commit to get the timestamp. This option enables the default theme to display the page's last updated time. You can customize the text via [`themeConfig.lastUpdatedText`](theme-configs#lastupdatedtext) option. ```ts export default { diff --git a/docs/config/theme-configs.md b/docs/config/theme-configs.md index b576a577..d98ea791 100644 --- a/docs/config/theme-configs.md +++ b/docs/config/theme-configs.md @@ -33,21 +33,6 @@ export default { } ``` -## lastUpdated - -- Type: `string` -- Default: `Last Updated` - -The Last Updated prompt text. - -```ts -export default { - themeConfig: { - lastUpdated: 'Updated Date' - } -} -``` - ## footer - Type: `Footer` @@ -72,6 +57,21 @@ export interface Footer { } ``` +## lastUpdatedText + +- Type: `string` +- Default: `Last updated` + +The prefix text showing right before the last updated time. + +```ts +export default { + themeConfig: { + lastUpdatedText: 'Updated Date' + } +} +``` + ## carbonAds - Type: `CarbonAds` diff --git a/src/client/theme-default/components/VPDocFooter.vue b/src/client/theme-default/components/VPDocFooter.vue index 8925cae6..f63e8b6f 100644 --- a/src/client/theme-default/components/VPDocFooter.vue +++ b/src/client/theme-default/components/VPDocFooter.vue @@ -5,7 +5,7 @@ import { useEditLink } from '../composables/edit-link' import { usePrevNext } from '../composables/prev-next' import VPIconEdit from './icons/VPIconEdit.vue' import VPLink from './VPLink.vue' -import VPLastUpdated from './VPLastUpdated.vue' +import VPDocFooterLastUpdated from './VPDocFooterLastUpdated.vue' const { theme, page, frontmatter } = useData() @@ -22,7 +22,10 @@ const control = usePrevNext() {{ editLink.text }} - + +
+ +
@@ -48,23 +51,28 @@ const control = usePrevNext() } .edit-info { - display: flex; - justify-content: space-between; - align-items: baseline; - line-height: 20px; - font-size: 14px; - font-weight: 500; + padding-bottom: 18px; +} + +@media (min-width: 640px) { + .edit-info { + display: flex; + justify-content: space-between; + align-items: baseline; + padding-bottom: 14px; + } } .edit-link { - padding-bottom: 14px; + line-height: 32px; + font-size: 14px; + font-weight: 500; } .edit-link-button { display: flex; align-items: center; border: 0; - padding: 10px 0; color: var(--vp-c-brand); transition: color 0.25s; } diff --git a/src/client/theme-default/components/VPDocFooterLastUpdated.vue b/src/client/theme-default/components/VPDocFooterLastUpdated.vue new file mode 100644 index 00000000..efaac851 --- /dev/null +++ b/src/client/theme-default/components/VPDocFooterLastUpdated.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/src/client/theme-default/components/VPLastUpdated.vue b/src/client/theme-default/components/VPLastUpdated.vue deleted file mode 100644 index 4e8eacca..00000000 --- a/src/client/theme-default/components/VPLastUpdated.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - diff --git a/types/default-theme.d.ts b/types/default-theme.d.ts index d01cf25a..5340ebcf 100644 --- a/types/default-theme.d.ts +++ b/types/default-theme.d.ts @@ -24,11 +24,11 @@ export namespace DefaultTheme { editLink?: EditLink /** - * Show last updated time at the bottom of the page. Defaults to `false`. - * If given a string, it will be displayed as a prefix (default value: - * "Last Updated"). + * Set custom last updated text. + * + * @default 'Last updated' */ - lastUpdated?: string | boolean + lastUpdatedText?: string /** * The social links to be displayed at the end of the nav bar. Perfect for