feat(theme): support footer frontmatter config (#2574)

pull/2667/head
bqy_fe 12 months ago committed by GitHub
parent 37d5b273fb
commit e79a13eb42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -246,6 +246,7 @@ type SocialLinkIcon =
## footer
- Type: `Footer`
- Can be overridden per page via [frontmatter](./frontmatter-config#footer)
Footer configuration. You can add a message or copyright text on the footer, however, it will only be displayed when the page doesn't contain a sidebar. This is due to design concerns.

@ -41,3 +41,13 @@ Only inline elements can be used in `message` and `copyright` as they are render
:::
Note that footer will not be displayed when the [SideBar](./default-theme-sidebar) is visible.
## Frontmatter Config
This can be disabled per-page using the `footer` option on frontmatter:
```yaml
---
footer: false
---
```

@ -160,3 +160,16 @@ Whether to display [Edit Link](./default-theme-edit-link) in the footer of the c
editLink: false
---
```
### footer <Badge type="info" text="default theme only" />
- Type: `boolean`
- Default: `true`
Whether to display [Footer](./default-theme-footer) in the footer of the current page.
```yaml
---
footer: false
---
```

@ -2,12 +2,12 @@
import { useData } from '../composables/data'
import { useSidebar } from '../composables/sidebar'
const { theme } = useData()
const { theme, frontmatter } = useData()
const { hasSidebar } = useSidebar()
</script>
<template>
<footer v-if="theme.footer" class="VPFooter" :class="{ 'has-sidebar': hasSidebar }">
<footer v-if="theme.footer && frontmatter.footer !== false" class="VPFooter" :class="{ 'has-sidebar': hasSidebar }">
<div class="container">
<p v-if="theme.footer.message" class="message" v-html="theme.footer.message"></p>
<p v-if="theme.footer.copyright" class="copyright" v-html="theme.footer.copyright"></p>

Loading…
Cancel
Save