feat(theme): allow overriding last updated time in doc footer from frontmatter (#2848)

pull/2512/head
Divyansh Singh 2 years ago committed by GitHub
parent e8ef1aaabe
commit 9a062a6dd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -163,10 +163,10 @@ The levels of header in the outline to display for the page. It's same as [confi
### lastUpdated
- Type: `boolean`
- Type: `boolean | Date`
- Default: `true`
Whether to display [last updated](./default-theme-last-updated) text in the footer of the current page.
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.
```yaml
---

@ -2,9 +2,11 @@
import { ref, computed, watchEffect, onMounted } from 'vue'
import { useData } from '../composables/data'
const { theme, page } = useData()
const { theme, page, frontmatter } = useData()
const date = computed(() => new Date(page.value.lastUpdated!))
const date = computed(
() => new Date(frontmatter.value.lastUpdated ?? page.value.lastUpdated)
)
const isoDatetime = computed(() => date.value.toISOString())
const datetime = ref('')

Loading…
Cancel
Save