VuePress EcosystemVuePress Ecosystem
  • Theme Guidelines
  • theme-default
  • Hope Theme
  • Plume Theme
  • Reco Theme
  • Feature Plugins
  • Markdown Plugins
  • Search Plugins
  • Blog Plugins
  • PWA Plugins
  • Analytics Plugins
  • SEO Plugins
  • Development Plugins
  • Tool Plugins
  • AI Plugins
  • @vuepress/helper
  • English
  • 简体中文
GitHub
  • Theme Guidelines
  • theme-default
  • Hope Theme
  • Plume Theme
  • Reco Theme
  • Feature Plugins
  • Markdown Plugins
  • Search Plugins
  • Blog Plugins
  • PWA Plugins
  • Analytics Plugins
  • SEO Plugins
  • Development Plugins
  • Tool Plugins
  • AI Plugins
  • @vuepress/helper
  • English
  • 简体中文
GitHub
  • back-to-top
  • catalog
  • copy-code
  • copyright
  • icon
  • media
  • medium-zoom
  • notice
  • nprogress
  • photo-swipe
  • watermark

notice

@vuepress/plugin-notice

Add notice popups to your site with this plugin.

Usage

npm i -D @vuepress/plugin-notice@next
.vuepress/config.ts
import { noticePlugin } from '@vuepress/plugin-notice'

export default {
  plugins: [
    noticePlugin({
      // options
    }),
  ],
}

Here is an example:

.vuepress/config.ts
import { noticePlugin } from '@vuepress/plugin-notice'
import { path } from 'vuepress/utils'

export default {
  plugins: [
    noticePlugin({
      config: [
        {
          path: '/',
          title: 'Notice Title',
          content: 'Notice Content',
          actions: [
            {
              text: 'Primary Action',
              link: 'https://theme-hope.vuejs.press/',
              type: 'primary',
            },
            { text: 'Default Action' },
          ],
        },
        {
          path: '/zh/',
          title: 'Notice Title',
          contentType: 'markdown',
          content: '**Notice Content** [link](https://example.com)',
          actions: [
            {
              text: 'Primary Action',
              link: 'https://theme-hope.vuejs.press/',
              type: 'primary',
            },
            { text: 'Default Action' },
          ],
        },
        {
          path: '/example/',
          title: 'Notice Title',
          contentFile: path.resolve(__dirname, 'notice.md'),
          actions: [
            {
              text: 'Primary Action',
              link: 'https://theme-hope.vuejs.press/',
              type: 'primary',
            },
            { text: 'Default Action' },
          ],
        },
      ],
    }),
  ],
}

Guide

Path Matching

You can set multiple notices for different paths on your site.

Each notice configuration requires either a path or match option to determine which pages it should appear on. The path option is a string that matches all paths starting with it, while the match option is a regular expression to test against the page route path.

Display Control

By default, notices are shown whenever users enter the site, and remain closed for the session if users close them.

To prevent notices from appearing again after users close them (even in future visits), set showOnce: true in the notice options.

Notice state is remembered based on the notice title and content. You can set a custom key option to use your own identifier, allowing you to edit notice content without bothering users who have already acknowledged them.

Fullscreen Mode

To display a fullscreen popup, use fullscreen: true in the notice options. We recommend combining this with confirm: true.

The notice will be displayed in the center of the screen, with other areas covered by a blur mask.

Close Button

By default, there is a close button on the right side of the notice, allowing users to dismiss it. Users can also close fullscreen notices by clicking the mask.

However, if you want users to acknowledge the notice, set confirm: true so users can only close the notice by clicking action buttons.

Options

configRequiredNoticeOptions[]

Notice configuration. Each item needs a path or a match to decide which pages the notice appears on, see Path Matching.

config[*].pathstring

Path prefix to match.

config[*].matchRegExp

A regexp matching the notice path.

config[*].titleRequiredstring

Notice title, which supports both text and HTML strings.

config[*].contentstring

Notice content, which supports text, HTML strings, and Markdown. Set contentType to markdown when using Markdown.

config[*].contentType'html' | 'markdown'
Default'html'

Notice content type.

config[*].contentFilestring

Absolute path of the notice content file, whose format should be .md or .html. The file content is used as content with a higher priority.

config[*].keystring

Notice key, used to identify and store the notice status.

See also: Display Control.

config[*].showOnceboolean

Whether to show the notice only once instead of on every visit.

See also: Display Control.

config[*].confirmboolean

Whether the notice shall be confirmed.

See also: Close Button.

config[*].fullscreenboolean

Whether the notice should appear fullscreen.

See also: Fullscreen Mode.

config[*].actionsNoticeActionOption[]

Notice actions.

config[*].actions[*].textRequiredstring

Action text.

config[*].actions[*].linkstring

Action link. Pathnames are treated as internal route links and handled by the router, while full URLs are treated as external links and opened in a new window.

config[*].actions[*].type'default' | 'primary'
Default'default'

Action type.

Edit this page on GitHub
Last Updated: 9/28/26, 4:40 AM
Contributors: Mister-Hope, meteorlxy, pengzhanbo
Prev
medium-zoom
Next
nprogress