feat(themeConfig):Added skip Title update

pull/4630/head
Lukas Leisten 6 months ago
parent f6414d319a
commit 23f13b175d

@ -451,6 +451,13 @@ Can be used to customize the aria-label of the language toggle button in navbar.
Can be used to customize the label of the skip to content link. This link is shown when the user is navigating the site using a keyboard.
## skipTitleUpdate
- Type: `boolean`
- Default: `false`
Can be used to skip the default title update logic so it can be implemented on your own.
## externalLinkIcon
- Type: `boolean`

@ -56,9 +56,11 @@ export function useUpdateHead(route: Route, siteDataByRouteRef: Ref<SiteData>) {
const frontmatterHead = (pageData && pageData.frontmatter.head) || []
// update title and description
const title = createTitle(siteData, pageData)
if (title !== document.title) {
document.title = title
if (!siteData.themeConfig.skipTitleUpdate) {
const title = createTitle(siteData, pageData)
if (title !== document.title) {
document.title = title
}
}
const description = pageDescription || siteData.description

@ -44,24 +44,22 @@ export function resolveAliases(
}
]
let vuePath = 'vue/dist/vue.esm-bundler.js'
if (!ssr) {
// Prioritize vue installed in project root and fallback to
// vue that comes with vitepress itself.
// Only do this when not running SSR build, since `vue` needs to be
// externalized during SSR
let vuePath
try {
vuePath = require.resolve(vueRuntimePath, { paths: [root] })
} catch (e) {
vuePath = require.resolve(vueRuntimePath)
}
aliases.push({
find: /^vue$/,
replacement: vuePath
})
}
aliases.push({
find: /^vue$/,
replacement: vuePath
})
return aliases
}

@ -127,6 +127,11 @@ export namespace DefaultTheme {
*/
skipToContentLabel?: string
/**
* @default false
*/
skipTitleUpdate?: boolean
search?:
| { provider: 'local'; options?: LocalSearchOptions }
| { provider: 'algolia'; options: AlgoliaSearchOptions }

Loading…
Cancel
Save