Skip to content

Commit 0b4ca20

Browse files
committed
feat: add sitemap
1 parent 30fa407 commit 0b4ca20

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ function genConfig() {
6565
HideLastUpdated,
6666
HideAuthors,
6767
rootDir,
68+
hostName,
6869
} = themeConfig
6970
const additionalNav = [
7071
{
@@ -114,6 +115,9 @@ function genConfig() {
114115
lang: 'zh-CN',
115116
title: siteTitle,
116117
base: baseUrl,
118+
sitemap: {
119+
hostname: hostName,
120+
},
117121
cleanUrls: true,
118122
markdown: {
119123
config(md) {
@@ -164,6 +168,9 @@ function genConfig() {
164168
// https://vitepress.dev/reference/default-theme-config
165169
siteTitle: SiteTitle,
166170
logo: siteLogo,
171+
sitemap: {
172+
hostname: hostName,
173+
},
167174
nav: combinedNav,
168175
sidebar: generateSidebar(),
169176
socialLinks: [{ icon: 'github', link: githubRepoLink }],

src/utils/themeContext.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface ThemeContext {
2222
HideReadingTime?: boolean
2323
HideLastUpdated?: boolean
2424
HideAuthors?: boolean
25+
hostName: string
2526
}
2627

2728
const themeContext = new AsyncLocalStorage<ThemeContext>()

0 commit comments

Comments
 (0)