Skip to content

Commit 9a062a6

Browse files
authoredAug 25, 2023
feat(theme): allow overriding last updated time in doc footer from frontmatter (#2848)
1 parent e8ef1aa commit 9a062a6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed
 

‎docs/reference/frontmatter-config.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ The levels of header in the outline to display for the page. It's same as [confi
163163
164164
### lastUpdated
165165
166-
- Type: `boolean`
166+
- Type: `boolean | Date`
167167
- Default: `true`
168168
169-
Whether to display [last updated](./default-theme-last-updated) text in the footer of the current page.
169+
Whether to display [last updated](./default-theme-last-updated) text in the footer of the current page. If a datetime is specified, it will be displayed instead of the last git modified timestamp.
170170
171171
```yaml
172172
---

‎src/client/theme-default/components/VPDocFooterLastUpdated.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
import { ref, computed, watchEffect, onMounted } from 'vue'
33
import { useData } from '../composables/data'
44
5-
const { theme, page } = useData()
5+
const { theme, page, frontmatter } = useData()
66
7-
const date = computed(() => new Date(page.value.lastUpdated!))
7+
const date = computed(
8+
() => new Date(frontmatter.value.lastUpdated ?? page.value.lastUpdated)
9+
)
810
const isoDatetime = computed(() => date.value.toISOString())
911
const datetime = ref('')
1012

0 commit comments

Comments
 (0)
Please sign in to comment.