Replace Components
When setting { custom: true }
in Behavior options, the theme will import components through @theme-hope
alias, so you can use it to replace any component of the theme.
How to Replace via Alias
You need to replace the component alias used in the theme with alias
option in your own VuePress config file.
import { getDirname, path } from "vuepress/utils";
import { hopeTheme } from "vuepress-theme-hope";
const __dirname = getDirname(import.meta.url);
export default {
theme: hopeTheme(
{
// your theme config here
},
{ custom: true },
),
alias: {
// Here you can redirect aliases to your own components
// For example, here we change the theme's home page component to HomePage.vue under user .vuepress/components
"@theme-hope/components/home/HomePage": path.resolve(
__dirname,
"./components/HomePage.vue",
),
},
};
Some components provide slots, in this case, you can directly import the original component when overriding the component, and pass in the content you need through the slot.
Theme Alias
Base Components
@theme-hope/components/base/AutoLink
: basic linkSlots:
default
,before
,after
@theme-hope/components/base/BreadCrumb
: breadcrumb@theme-hope/components/base/EditIcon
: edit icon@theme-hope/components/base/MainFadeInUpTransition
: main layout transitionSlots:
default
@theme-hope/components/base/MainLayout
: main layoutSlots:
default
,navScreenTop
,navScreenBottom
,sidebarItems
,sidebarTop
,sidebarBottom
navScreenTop
navScreenBottom
slots are piped toNavBar
component.sidebarItems
,sidebarTop
,sidebarBottom
slots are piped toSidebar
component.
@theme-hope/components/base/MarkdownContent
: Markdown contentSlots:
contentBefore
,contentAfter
@theme-hope/components/base/PageContent
: main page contentSlots:
pageTop
,pageBottom
,content
,contentBefore
,contentAfter
,toc
,tocBefore
,tocAfter
contentBefore
,contentAfter
slots are piped toMarkdownContent
component.toc
,tocBefore
,tocAfter
slots are piped toTOC
component.
@theme-hope/components/base/PageFooter
: page footer@theme-hope/components/base/PrintButton
: print button@theme-hope/components/base/PageNav
: page navigation@theme-hope/components/base/PageTitle
: page title@theme-hope/components/base/SkipLink
: link pointing to main content@theme-hope/components/base/TOC
: table of contentsSlots:
toc
tocBefore
,tocAfter
Home Page Components
@theme-hope/components/home/FeatureSection
: homepage feature section@theme-hope/components/home/HighlightSection
: homepage highlight section@theme-hope/components/home/HeroInfo
: homepage logo and introductionSlots:
heroInfo
,heroLogo
,heroBg
heroInfo
slot receivestext
tagline
isFullScreen
andstyle
props.heroLogo
slot receivesimage
imageDark
alt
andstyle
props.heroBg
slot receivesimage
imageDark
andstyle
props.
@theme-hope/components/home/HeroSlideDownButton
: hero slide down button@theme-hope/components/home/HomePage
: default home page (project home page)Slots:
heroInfo
,heroLogo
,heroBg
,heroBefore
,heroAfter
,content
,contentBefore
,contentAfter
heroInfo
,heroLogo
,heroBg
slots are piped toHeroInfo
component.contentBefore
,contentAfter
slots are piped toMarkdownContent
component.
@theme-hope/components/home/PortfolioHero
: portfolio heroSlots:
portfolioInfo
,portfolioAvatar
,portfolioBg
portfolioInfo
slot receivesname
welcome
title
titles
andlinks
props.portfolioAvatar
slot receivesavatar
avatarDark
style
andalt
props.portfolioBg
slot receivesimage
imageDark
andstyle
props.
@theme-hope/components/home/PortfolioHome
: portfolio home pageSlots:
portfolioInfo
,portfolioAvatar
,portfolioBg
portfolioInfo
,portfolioAvatar
,portfolioBg
slots are piped toPortfolioHero
component.
Navbar Components
@theme-hope/components/navbar/I18nIcon
: i18n icon@theme-hope/components/navbar/LanguageDropdown
: language dropdown@theme-hope/components/navbar/Navbar
: navbar componentSlots:
navScreenTop
,navScreenBottom
navScreenTop
navScreenBottom
slots are piped toNavBar
component.
@theme-hope/components/navbar/NavbarBrand
: navbar brand information@theme-hope/components/navbar/NavbarDropdown
: dropdown listSlots:
title
@theme-hope/components/navbar/NavbarLinks
: navbar links@theme-hope/components/navbar/NavScreen
: navigation screen in mobile viewSlots:
navScreenTop
,navScreenBottom
@theme-hope/components/navbar/NavScreenLinks
: mobile view navbar links@theme-hope/components/navbar/NavScreenMenu
: mobile view navbar dropdown menu@theme-hope/components/navbar/RepoLink
: repository link@theme-hope/components/navbar/ToggleNavbarButton
: navbar toggle button@theme-hope/components/navbar/ToggleSidebarButton
: sidebar toggle button
Sidebar Components
@theme-hope/components/sidebar/Sidebar
: sidebarSlots:
sidebarItems
,sidebarTop
,sidebarBottom
sidebarItems
slot receivessidebarItems
prop.
@theme-hope/components/sidebar/SidebarChild
: sidebar link item@theme-hope/components/sidebar/SidebarGroup
: sidebar grouping links@theme-hope/components/sidebar/SidebarLinks
: sidebar links
Info Components
@theme-hope/components/info/AuthorInfo
: author information@theme-hope/components/info/CategoryInfo
: category information@theme-hope/components/info/DateInfo
: date information@theme-hope/components/info/OriginalInfo
: original mark@theme-hope/components/info/PageInfo
: page information@theme-hope/components/info/PageMeta
: page meta information@theme-hope/components/info/PageViewInfo
: page views information@theme-hope/components/info/ReadingTimeInfo
: reading time information@theme-hope/components/info/TagInfo
: tag information@theme-hope/components/info/WordInfo
: word information@theme-hope/components/info/icons
: info icons
Appearance Components
@theme-hope/components/appearance/AppearanceButton
: appearance button@theme-hope/components/appearance/AppearanceIcon
: appearance icon@theme-hope/components/appearance/AppearanceSettings
: appearance settings@theme-hope/components/appearance/ColorMode
: color mode@theme-hope/components/appearance/ColorModeSwitch
: color mode switch@theme-hope/components/appearance/ThemeColor
: theme color@theme-hope/components/appearance/ThemeColorPicker
: theme color picker@theme-hope/components/appearance/ToggleFullScreen
: fullscreen toggle@theme-hope/components/appearance/ToggleFullScreenButton
: fullscreen toggle button
Transition Components
@theme-hope/components/transition/DropTransition
: drop transition componentSlots:
default
Blog Components
@theme-hope/components/blog/ArticleItem
: article itemSlots:
articleTitle
,articleCover
,articleInfo
,articleExcerpt
articleTitle
slot receivestitle
isEncrypted
andtype
props.articleCover
slot receivescover
props.articleInfo
slot receivesauthor
category
tag
date
isOriginal
pageview
readingTime
andreadingTimeLocale
props.articleExcerpt
slot receivesexcerpt
props.
@theme-hope/components/blog/ArticleList
: article listSlots:
articleTitle
,articleCover
,articleInfo
,articleExcerpt
articleTitle
,articleCover
,articleInfo
,articleExcerpt
slots are piped toArticleItem
component.
@theme-hope/components/blog/ArticlesInfo
: article info@theme-hope/components/blog/ArticleType
: article type@theme-hope/components/blog/BloggerInfo
: blogger infoSlots:
bloggerInfo
bloggerInfo
slot receivesname
avatar
anddescription
props.
@theme-hope/components/blog/BlogHero
: blog homepage logo and introductionSlots:
heroInfo
,heroLogo
,heroBg
,heroBg
slot receivestext
tagline
isFullScreen
andstyle
props.heroLogo
slot receivesimage
imageDark
alt
andstyle
props.heroBg
slot receivesimage
imageDark
andstyle
props.
@theme-hope/components/blog/BlogHome
: blog homeSlots:
heroInfo
,heroLogo
,heroBg
,heroBefore
,heroAfter
,articleCover
,articleTitle
,articleInfo
,articleExcerpt
,bloggerInfo
,infoBefore
,infoAfter
,content
,contentBefore
,contentAfter
heroInfo
,heroLogo
,heroBg
slots are piped toBlogHero
component.articleTitle
,articleCover
,articleInfo
,articleExcerpt
slots are piped toArticleList
component.bloggerInfo
slot is piped to BloggerInfo` component.infoBefore
,infoAfter
slots are piped toInfoPanel
component.contentBefore
,contentAfter
slots are piped toMarkdownContent
component.
@theme-hope/components/blog/BlogMainLayout
: blog main layoutSlots:
default
,navScreenTop
,navScreenBottom
,sidebarItems
,sidebarTop
,sidebarBottom
,bloggerInfo
navScreenTop
,navScreenBottom
slots are piped toNavBar
component.
@theme-hope/components/blog/CategoriesInfo
: Category info@theme-hope/components/blog/CategoryList
: Category list@theme-hope/components/blog/CategoryPage
: category pageSlots:
default
,articleTitle
,articleCover
,articleInfo
,articleExcerpt
,articleBefore
,articleAfter
,bloggerInfo
,infoBefore
,infoAfter
articleTitle
,articleCover
,articleInfo
,articleExcerpt
slots are piped toArticleList
component.bloggerInfo
slot is piped to ``BloggerInfo` component.infoBefore
,infoAfter
slots are piped toInfoPanel
component.
@theme-hope/components/blog/InfoList
: blog info listSlots:
bloggerInfo
,infoBefore
,infoAfter
@theme-hope/components/blog/InfoPanel
: blog info panelbloggerInfo
slot is piped to ``BloggerInfo` component.
@theme-hope/components/blog/Pagination
: pagination@theme-hope/components/blog/ProjectPanel
: blog homepage project panel@theme-hope/components/blog/SocialMedias
: social media links@theme-hope/components/blog/TagList
: tag list@theme-hope/components/blog/TagPage
: tag page@theme-hope/components/blog/TagsInfo
: tag info@theme-hope/components/blog/TimelineItems
: timeline items@theme-hope/components/blog/TimelineList
: timeline List@theme-hope/components/blog/TimelinePage
: timeline pageSlots:
articleBefore
,articleAfter
,bloggerInfo
,infoBefore
,infoAfter
bloggerInfo
slot is piped to ``BloggerInfo` component.infoBefore
,infoAfter
slots are piped toInfoPanel
component.
@theme-hope/components/blog/TypePage
: type pageSlots:
default
,articleTitle
,articleCover
,articleInfo
,articleExcerpt
,articleBefore
,articleAfter
,bloggerInfo
,infoBefore
,infoAfter
articleTitle
,articleCover
,articleInfo
,articleExcerpt
slots are piped toArticleList
component.bloggerInfo
slot is piped to ``BloggerInfo` component.infoBefore
,infoAfter
slots are piped toInfoPanel
component.
@theme-hope/components/blog/icons
: blog icons
Encryption Components
@theme-hope/modules/encrypt/components/GlobalEncrypt
: global encrypt wrapperSlots:
default
@theme-hope/modules/encrypt/components/LocalEncrypt
: local encrypt wrapperSlots:
default
@theme-hope/modules/encrypt/components/PasswordModal
: password input box
Others
Composables, layouts, utils can be also replaced via alias, check theme source code for details.
Changelog
1e9f5
-on98fc7
-on329ae
-onf3e43
-onb1230
-onf7910
-onedfd5
-onf565a
-on2c32a
-on6ad69
-on9ff54
-one788a
-on6c081
-on95ac5
-on3360a
-onf9d00
-on54c46
-on05f91
-on2f38e
-on794f9
-on31bea
-ond7e50
-onc2e16
-onfa8bb
-on2a306
-on39704
-ona0afc
-onf314f
-on92fc8
-on21d14
-on9a137
-onf1436
-on96e01
-on74d2f
-onbade3
-on8174c
-ona0c8a
-onaafa6
-on42b11
-on3f76b
-onc4fe2
-on79ac6
-on8e2fc
-on2243a
-on13530
-onad675
-on4659f
-on2fa50
-on393ff
-on23515
-on9cdd7
-on63d09
-onad023
-on7f1ab
-on22000
-onfd395
-on73de5
-onfc15c
-onda2ed
-on21000
-onbcf02
-on716f9
-onf6ff0
-on95ff3
-on37324
-on