VuePress Copy Page PluginVuePress Copy Page Plugin
Home
Posts
Docs
About
  • English
  • 简体中文
Home
Posts
Docs
About
  • English
  • 简体中文
  • Documentation

    • Introduction
    • Configuration

Configuration

Learn how to configure the vuepress-plugin-copy-page plugin for your VuePress site.

Installation

First, install the plugin:

npm install vuepress-plugin-copy-page

Step 1: Plugin Configuration

Add the plugin to your VuePress config file:

// .vuepress/config.ts
import { copyPagePlugin } from 'vuepress-plugin-copy-page'

export default {
  plugins: [
    copyPagePlugin({
      includes: ['/docs/', '/guide/'],
      excludes: ['/docs/drafts/'],
    }),
  ],
}

Step 2: Client Configuration

Register the client component:

// .vuepress/client.ts
import { defineClientConfig } from 'vuepress/client'
import CopyPageWidget from 'vuepress-plugin-copy-page/client'

export default defineClientConfig({
  rootComponents: [CopyPageWidget],
})

Configuration Options

includes

Specify which page paths should include the copy button.

{
  includes: ['/blog/', '/docs/']  // Only blog and docs pages
}

excludes

Specify which page paths should exclude the copy button.

{
  excludes: ['/about/', '/home/']  // All pages except about and home
}

Combined Usage

You can use both options together:

{
  includes: ['/docs/', '/blog/'],
  excludes: ['/docs/drafts/', '/blog/private/']
}

Default Behavior

When no options are provided, the copy button appears on pages matching the default includes:

copyPagePlugin()  // Default: includes ['/posts/']

Examples

Documentation Site

copyPagePlugin({
  includes: ['/docs/'],
})

Blog with Private Posts

copyPagePlugin({
  includes: ['/blog/'],
  excludes: ['/blog/drafts/', '/blog/private/'],
})

Full Site Excluding Pages

copyPagePlugin({
  excludes: ['/about/', '/contact/', '/legal/'],
})

Notes

  • Path matching uses prefix matching (e.g., /docs/ matches /docs/guide and /docs/api/reference)
  • Exclusions take priority over inclusions
  • Paths should start with / and include trailing / for directories
  • Index pages (paths ending with /) are automatically excluded
Last Updated: 2/22/26, 8:18 PM
Contributors: zhaofutao
Prev
Introduction