Config Migration Guide
// .vuepress/config.ts
- import theme from "vuepress-theme-hope";
+ import { defineUserConfig } from "vuepress";
+ import { hopeTheme } from "vuepress-theme-hope";
- export default theme.config({
+ export default defineUserConfig({
// your site config here
// ...
- themeConfig:{
+ theme: hopeTheme({
// your theme config here
// ...
- },
+ }),
});
// .vuepress/config.js
- const { config } = require("vuepress-theme-hope");
+ import { hopeTheme } from "vuepress-theme-hope";
- module.exports = theme.config({
+ export default {
// your site config here
// ...
- themeConfig:{
+ theme: hopeTheme({
// your theme config here
// ...
- },
+ }),
- });
+ };
Theme Usage
- rename
themeConfig
tohopeTheme
- rename
navbarConfig
tonavbar
- rename
sidebarConfig
tosidebar
- added
arraySidebar
andobjectSidebar
helpers - remove
config
Theme Options
changed
author
type fromstring | undefined
toAuthorInfo[] | AuthorInfo | string[] | string | undefined
interface AuthorInfo { /** * Author name */ name: string; /** * Author website */ url?: string; /** * Author email */ email?: string; }
This change allows you to add multiple authors and set sites for them.
Navigation Bar
unified
nav
,navbar
tonavbar
rename
darkLogo
tologoDark
rename
navAutoHide
tonavbarAutoHide
added
navbarIcon
option to control navbar icon displayadded
navbarLayout
option to control navbar layout
Sidebar
rename
sidebarDepth
toheaderDepth
remove
displayAllHeaders
support generating sidebar automatically from file structure
Navbar Sidebar Config Unified
change
items
in navbar config tochildren
change
title
totext
andpath
tolink
in sidebar configuration.V2 navbar supports setting the Markdown file path directly like the sidebar to automatically generate text, icons and links
add
activeMatch
to control route activation
So both are unified as text
, icon
, prefix
, link
, children
, activeMatch
.
Search
Since the theme no longer has a built-in search:
remove
search
,searchPlaceholder
,searchMaxSuggestions
remove
algolia
,algoliaType
Page Link
rename
prevLinks
toprevLink
rename
nextLinks
tonextLink
rename
editLinks
toeditLink
rename
updateTime
tolastUpdated
Outlook
Add
iconAssets
optioniconPrefix
default value now infers fromiconAssets
update values of
darkmode
option- add
"enable"
- rename
"switch"
to"toggle"
- rename
"auto-switch"
to"switch"
- add
themeColor
andfullscreen
is disabled by default
Blog Config
supports separate config in each language
add
blog.description
to set blogger description or mottorename
blog.links
toblog.medias
change default value of
blog.roundAvatar
fromtrue
tofalse
rename
blog.perPage
toblog.articlePerPage
move
blog.autoExcerpt
toplugins.blog.excerptLength
Encryption Config
change
encrypt.status: "global" | "local"
(default"local"
) toencrypt.global: boolean
(defaultfalse
)rename
encrypt.global
toencrypt.admin
custom layout
- remove
custom
Page Layout
- rename
anchorDisplay
totoc
Reading Speed
- move
wordPerMinute
toplugins.readingTime.wordPerMinute
Plugin Changes
Addition
- Added
plugins.blog
to control blog links - Added
plugins.nprogress
to control nprogress - Added
plugins.prismjs
to control Prism.js
Changes
Move all plugin related options under plugins
.
rename
activeHash
toplugins.activeHeaderLinks
The theme now uses official plugin
@vuepress/plugin-active-header-links
.move
comment
moved toplugins.comment
move
copyCode
toplugins.copyCode
move
copyright
toplugins.copyright
The plugin is disabled by default now.
move
feed
toplugins.feed
Supports removing custom components and elements through
plugins.feed.preservedElements
optionsVisualized atom and rss feeds, configurable with
plugins.feed.atomXslFilename
plugins.feed.atomXslTemplate
plugins.feed.rssXslFilename
andplugins.feed.rssXslTemplate
Customize feed generation via
plugins.feed.getter
optionMulti-category support
Move all output options from
plugins.feed.output
option to plugin option root and rename them.feed.output.atom.enable
renamed toplugins.feed.atom
feed.output.json.enable
renamed toplugins.feed.json
feed.output.rss.enable
renamed toplugins.feed.rss
feed.output.atom.path
renamed toplugins.feed.atomOutputFilename
feed.output.json.path
renamed toplugins.feed.jsonOutputFilename
feed.output.rss.path
renamed toplugins.feed.rssOutputFilename
plugins.feed.atom
,plugins.feed.json
andplugins.feed.rss
isfalse
by defaultThe theme no longer outputs feed files in three formats by default. If necessary, please set options to output formats needed.
move
git
toplugins.git
The theme use official plugin
@vuepress/plugin-git
now.move
mdEnhance
toplugins.mdEnhance
Markdown link check
The plugin now check your Markdown links and warn you when broken links are detected.
You can control this behavior with
plugins.mdEnhance.checkLinks
optionimage mark support
Use
#light
and#dark
suffix to mark images to display them in light mode or dark mode viaplugins.mdEnhance.imgMark
optionChart.js support
Adds chart.js support via
plugins.mdEnhance.chart
option::: chart Title ```json { // chart.js config } ``` ::: ::: chart Title ```js const config = { // chart.js config }; ``` :::
ECharts support
Adds ECharts support via
plugins.mdEnhance.echarts
option::: echarts Title ```json { // chart.js config } ``` ::: ::: echarts Title ```js const option = { // chart.js config }; ``` :::
content include support
use
@include
to include other file content in Markdown viaplugins.mdEnhance.include
options.Use
<!-- @include: filename -->
to include a file.To partially import the file, you can specify the range of lines to be included:
<!-- @include: filename{start-end} -->
<!-- @include: filename{start-} -->
<!-- @include: filename{-end} -->
Also, you can include file region:
<!-- @include: filename#region -->
tabs support
Use
tabs
container to create tabs viaplugins.mdEnhance.tabs
option.add
plugins.mdEnhance.gfm
Control supporting gfm
add
plugins.mdEnhance.vPre
The following syntax is no longer built into VuePress2, so we add this option.
::: v-pre :::
rename
mdEnhance.codegroup
toplugins.mdEnhance.codetabs
rename
plugins.mdEnhance.lazyLoad
toplugins.mdEnhance.lazyLoad
and change default value fromtrue
tofalse
remove
plugins.mdEnhance.enableAll
There are too many noob users who don't know what they are doing, and they just enable this option without using all the feature provided, yet they complain about load speed.
remove
plugins.mdEnhance.lineNumbers
VuePress2 supports line numbers config for code blocks individually
remove
plugins.mdEnhance.imageFix
Image related issues have been fixed in V2
move
photoSwipe
toplugins.photoSwipe
move
pwa
toplugins.pwa
plugins.pwa.update
: control the update logic of SW
"disabled"
: Do nothing even when new service worker is available. After new service work succeeds installing and starts waiting, it will control page and provide new content in next visit."available"
: Only display update popup when the new service worker is available"hint"
: Display a hint to let user choose to refresh immediately"force"
: unregister current service worker immediately then refresh to get new content
plugins.pwa.appendBase
: automatically insert
base
to themanifest
optionplugins.pwa.hintComponent
: Hint component for detecting new content
shouldPrefetch hint
: Now the plugin will check
shouldPrefetch
option in config file and warn you to disable it.plugins.pwa.cacheHTML
default value changed fromtrue
tofalse
This can effectively reduce the SW update time
pwa.popupComponent
renamed toplugins.pwa.updateComponent
This is because we added a new prompt popup window, so we need to avoid name confusion
move
readingTime
toplugins.readingTime
move
seo
toplugins.seo
JSON-LD support
The plugin now can generate JSON-LD script tags for you, and is providing an option
plugin.seo.jsonLd
to let you customize the JSON-LD properties.Description generation
The plugin can generate a description for you automatically via
plugin.seo.autoDescription
optionsCanonical link
You can set canonical link via
plugin.seo.canonicalLink
option. It's useful when your docs are deployed in several places.seo.customMeta
renamed toplugin.seo.customHead
Now you can edit all head tags instead of only meta in V1.
move
sitemap
toplugins.sitemap
Visualized sitemap, configurable with
plugins.sitemap.sitemapXSLFilename
andplugins.sitemap.sitemapXSLTemplate
plugin.sitemap.priority
: setting default value for priority
sitemap.urls
renamed toplugin.sitemap.extraUrls
sitemap.exclude
renamed toplugin.sitemap.excludeUrls
sitemap.outFile
renamed toplugin.sitemap.sitemapFilename
sitemap.modifyTimeGetter
renamed toplugin.sitemap.modifyTimeGetter
Deletion
remove
chunkRename
The theme no longer provides this functionality.
remove
cleanUrl
The theme no longer provides this functionality.
remove
git
The theme now uses official plugin
@vuepress/plugin-git
.remove
smoothScroll
The theme now provides smooth scrolling via CSS and no longer provides compatibility with older browsers.