Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(theme): support footer frontmatter config #2574

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/reference/default-theme-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
10 changes: 10 additions & 0 deletions docs/reference/default-theme-footer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
```
13 changes: 13 additions & 0 deletions docs/reference/frontmatter-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
```
4 changes: 2 additions & 2 deletions src/client/theme-default/components/VPFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import { useSidebar } from 'vitepress/theme'
import { useData } from '../composables/data'

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>
Expand Down