Skip to content

Commit

Permalink
feat(theme): allow overriding last updated time in doc footer from fr…
Browse files Browse the repository at this point in the history
…ontmatter (#2848)
  • Loading branch information
brc-dd committed Aug 25, 2023
1 parent e8ef1aa commit 9a062a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/reference/frontmatter-config.md
Expand Up @@ -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
---
Expand Down
Expand Up @@ -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('')
Expand Down

0 comments on commit 9a062a6

Please sign in to comment.