Component Replacement
Replace theme components using alias when { custom: true } is set in behavior options.
Alias Configuration
Configure component replacement in your VuePress config:
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: {
// Replace theme components with custom implementations
// 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",
),
},
};For components with slots, you can import them and customize content through slots.
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,sidebarBottomnavScreenTopnavScreenBottomslots are piped toNavBarcomponent.sidebarItems,sidebarTop,sidebarBottomslots are piped toSidebarcomponent.
@theme-hope/components/base/MarkdownContent: Markdown contentSlots:
contentBefore,contentAfter@theme-hope/components/base/PageContent: main page contentSlots:
pageTop,pageBottom,content,contentBefore,contentAfter,toc,tocBefore,tocAftercontentBefore,contentAfterslots are piped toMarkdownContentcomponent.toc,tocBefore,tocAfterslots are piped toTOCcomponent.
@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,heroBgheroInfoslot receivestexttaglineisFullScreenandstyleprops.heroLogoslot receivesimageimageDarkaltandstyleprops.heroBgslot receivesimageimageDarkandstyleprops.
@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,contentAfterheroInfo,heroLogo,heroBgslots are piped toHeroInfocomponent.contentBefore,contentAfterslots are piped toMarkdownContentcomponent.
@theme-hope/components/home/PortfolioHero: portfolio heroSlots:
portfolioInfo,portfolioAvatar,portfolioBgportfolioInfoslot receivesnamewelcometitletitlesandlinksprops.portfolioAvatarslot receivesavataravatarDarkstyleandaltprops.portfolioBgslot receivesimageimageDarkandstyleprops.
@theme-hope/components/home/PortfolioHome: portfolio home pageSlots:
portfolioInfo,portfolioAvatar,portfolioBgportfolioInfo,portfolioAvatar,portfolioBgslots are piped toPortfolioHerocomponent.
Navbar Components
@theme-hope/components/navbar/I18nIcon: i18n icon@theme-hope/components/navbar/LanguageDropdown: language dropdown@theme-hope/components/navbar/Navbar: navbar componentSlots:
navScreenTop,navScreenBottomnavScreenTopnavScreenBottomslots are piped toNavBarcomponent.
@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,sidebarBottomsidebarItemsslot receivessidebarItemsprop.
@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,articleExcerptarticleTitleslot receivestitleisEncryptedandtypeprops.articleCoverslot receivescoverprops.articleInfoslot receivesauthorcategorytagdateisOriginalpageviewreadingTimeandreadingTimeLocaleprops.articleExcerptslot receivesexcerptprops.
@theme-hope/components/blog/ArticleList: article listSlots:
articleTitle,articleCover,articleInfo,articleExcerptarticleTitle,articleCover,articleInfo,articleExcerptslots are piped toArticleItemcomponent.
@theme-hope/components/blog/ArticlesInfo: article info@theme-hope/components/blog/ArticleType: article type@theme-hope/components/blog/BloggerInfo: blogger infoSlots:
bloggerInfobloggerInfoslot receivesnameavataranddescriptionprops.
@theme-hope/components/blog/BlogHero: blog homepage logo and introductionSlots:
heroInfo,heroLogo,heroBg,heroBgslot receivestexttaglineisFullScreenandstyleprops.heroLogoslot receivesimageimageDarkaltandstyleprops.heroBgslot receivesimageimageDarkandstyleprops.
@theme-hope/components/blog/BlogHome: blog homeSlots:
heroInfo,heroLogo,heroBg,heroBefore,heroAfter,articleCover,articleTitle,articleInfo,articleExcerpt,bloggerInfo,infoBefore,infoAfter,content,contentBefore,contentAfterheroInfo,heroLogo,heroBgslots are piped toBlogHerocomponent.articleTitle,articleCover,articleInfo,articleExcerptslots are piped toArticleListcomponent.bloggerInfoslot is piped toBloggerInfocomponent.infoBefore,infoAfterslots are piped toInfoPanelcomponent.contentBefore,contentAfterslots are piped toMarkdownContentcomponent.
@theme-hope/components/blog/BlogMainLayout: blog main layoutSlots:
default,navScreenTop,navScreenBottom,sidebarItems,sidebarTop,sidebarBottom,bloggerInfonavScreenTop,navScreenBottomslots are piped toNavBarcomponent.
@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,infoAfterarticleTitle,articleCover,articleInfo,articleExcerptslots are piped toArticleListcomponent.bloggerInfoslot is piped toBloggerInfocomponent.infoBefore,infoAfterslots are piped toInfoPanelcomponent.
@theme-hope/components/blog/InfoList: blog info listSlots:
bloggerInfo,infoBefore,infoAfter@theme-hope/components/blog/InfoPanel: blog info panelbloggerInfoslot is piped toBloggerInfocomponent.
@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,infoAfterbloggerInfoslot is piped toBloggerInfocomponent.infoBefore,infoAfterslots are piped toInfoPanelcomponent.
@theme-hope/components/blog/TypePage: type pageSlots:
default,articleTitle,articleCover,articleInfo,articleExcerpt,articleBefore,articleAfter,bloggerInfo,infoBefore,infoAfterarticleTitle,articleCover,articleInfo,articleExcerptslots are piped toArticleListcomponent.bloggerInfoslot is piped toBloggerInfocomponent.infoBefore,infoAfterslots are piped toInfoPanelcomponent.
@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
05fbb-on2a19e-on1e9f5-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