From ddb77a06a5bea91593d797ee307fcf2f115dd60b Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Thu, 20 Nov 2025 21:09:26 +0800 Subject: [PATCH] feat(theme): add `footer` frontmatter --- docs/config/frontmatter/basic.md | 8 ++++++++ docs/en/config/frontmatter/basic.md | 8 ++++++++ theme/src/client/components/VPFooter.vue | 6 +++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/config/frontmatter/basic.md b/docs/config/frontmatter/basic.md index d14ba7aa..a8f86723 100644 --- a/docs/config/frontmatter/basic.md +++ b/docs/config/frontmatter/basic.md @@ -227,3 +227,11 @@ permalink: /config/frontmatter/basic/ 当类型为 WatermarkOptions 时,表示当前页面水印配置。 可以参考 [watermark-js-plus](https://zhensherlock.github.io/watermark-js-plus/zh/config/) 。 + +### footer + +- 类型: `boolean` +- 默认值: `true` +- 详情: + + 当前文章是否 显示 页脚信息。 diff --git a/docs/en/config/frontmatter/basic.md b/docs/en/config/frontmatter/basic.md index d7b7468a..b683b4a9 100644 --- a/docs/en/config/frontmatter/basic.md +++ b/docs/en/config/frontmatter/basic.md @@ -228,3 +228,11 @@ Display a badge on the right side of the article title. When the type is WatermarkOptions, it represents the watermark configuration for the current page. You can refer to [watermark-js-plus](https://zhensherlock.github.io/watermark-js-plus/zh/config/). + +### footer + +- Type: `boolean` +- Default: `true` +- Details: + + Whether to display the footer for the current article. diff --git a/theme/src/client/components/VPFooter.vue b/theme/src/client/components/VPFooter.vue index 32c8ab4e..5e2cef21 100644 --- a/theme/src/client/components/VPFooter.vue +++ b/theme/src/client/components/VPFooter.vue @@ -4,21 +4,21 @@ import { onMounted, ref } from 'vue' import { useData, useSidebar } from '../composables/index.js' import { inBrowser } from '../utils/index.js' -const { theme } = useData() +const { theme, frontmatter } = useData() const { hasSidebar } = useSidebar() const footerHeight = useCssVar('--vp-footer-height', inBrowser ? document.body : null) const footer = ref(null) onMounted(() => { - if (theme.value.footer && footer.value) + if (theme.value.footer && frontmatter.value.footer !== false && footer.value) footerHeight.value = `${footer.value.offsetHeight}px` })