Watermark
About 395 words
Overview
The theme's built-in watermark plugin adds watermarks to the entire site or individual pages.
Related plugin: @vuepress/plugin-watermark
For feature details, please refer to Watermark Feature
Usage
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
export default defineUserConfig({
theme: plumeTheme({
// watermark: true,
watermark: {
// enabled: false, // boolean type controls global enablement
enabled: page => true, // function type filters which pages enable watermark
/**
* Whether to enable full-page watermark, defaults to `true`,
* When set to `false`, watermark is only displayed in the content area.
*/
fullPage: true,
/** @see https://zhensherlock.github.io/watermark-js-plus/zh/config/ */
watermarkOptions: {
content: 'your watermark',
// ...
}
},
})
})For configuration entry priority information, please refer to Plugin Configuration Entry.
Configuration Options
enabled
Type:
boolean | ((page: Page) => boolean)Default:
trueDetails:
Specifies which pages should have watermarks added.
Pages with a
truevalue will have watermarks applied.The default
truedoes not conflict with "no watermark when not configured"The theme only registers the watermark plugin when
watermarkis configured (either the top-levelwatermarkorplugins.watermark), and it explicitly passesenabled: truewhen registering. Therefore whenwatermarkis not configured, no watermark appears anywhere on the site; thetruehere describes the default behavior once the watermark has been configured, and it is not an on/off switch.
fullPage
Type:
booleanDefault:
trueDetails:
Whether to use a full-page watermark. This is a theme extension field;
@vuepress/plugin-watermarkitself does not have this option.true: The watermark covers the entire pagefalse: The watermark is only displayed within the content area
A single page can also override this by setting
watermark.fullPage: falsein frontmatter.
watermarkOptions
Type:
WatermarkOptionsDefault:
undefinedDetails: Configuration options refer to watermark-js-plus.
watermarkOptions.parent
Type:
stringDefault:
bodyDetails: Parent element selector for adding watermarks.
By default inserted into the body, can be specified to insert into a specific element on the page.
Frontmatter
watermark
Type:
boolean | WatermarkOptionsDetails:
When type is
boolean, indicates whether to enable watermark.When type is
WatermarkOptions, indicates current page watermark configuration.Refer to watermark-js-plus for configuration options.
---
watermark:
width: 200
height: 200
content: Your content
opacity: 0.5
---