fix(docs): base url for all links

This commit is contained in:
Neko Ayaka
2025-07-15 13:04:36 +08:00
parent e70bc1368c
commit e2adbafa97
14 changed files with 20 additions and 12 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ import homeCover from '../assets/home-cover-2025-07-15.png'
Download
</a>
<a
href="./docs/overview/"
href="./overview/"
class="rounded-lg bg-white/60 px-4 py-2 text-slate-900 font-extrabold outline-none backdrop-blur-md dark:bg-white/20 dark:text-slate-100 focus:outline-none"
>
Get Started
+19 -10
View File
@@ -1,5 +1,6 @@
import type { DefaultTheme } from 'vitepress'
import { posix } from 'node:path'
import { env } from 'node:process'
import anchor from 'markdown-it-anchor'
@@ -29,6 +30,14 @@ import {
// `
// }
function withBase(url: string) {
return env.BASE_URL
? env.BASE_URL.endsWith('/')
? posix.join(env.BASE_URL.replace(/\/$/, ''), url)
: posix.join(env.BASE_URL, url)
: url
}
// https://vitepress.dev/reference/site-config
export default defineConfig({
cleanUrls: true,
@@ -59,8 +68,8 @@ export default defineConfig({
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Docs', link: '/docs/overview/' },
{ text: 'Blog', link: '/blog/' },
{ text: 'Docs', link: withBase('/overview/') },
{ text: 'Blog', link: withBase('/blog/') },
{
text: `v${version}`,
items: [
@@ -78,22 +87,22 @@ export default defineConfig({
text: 'Overview',
icon: 'lucide:rocket',
items: [
{ text: 'Introduction', link: '/docs/overview/' },
{ text: 'About AI Vtuber', link: '/docs/overview/about-ai-vtuber' },
{ text: 'About Neuro-sama', link: '/docs/overview/about-neuro-sama' },
{ text: 'Introduction', link: withBase('/overview/') },
{ text: 'About AI Vtuber', link: withBase('/overview/about-ai-vtuber') },
{ text: 'About Neuro-sama', link: withBase('/overview/about-neuro-sama') },
],
},
{
text: 'Guides',
icon: 'lucide:book-open',
items: [
{ text: 'Contributing', link: '/docs/guides/contributing/' },
{ text: 'Contributing', link: withBase('/guides/contributing/') },
{
text: 'Design Guidelines',
link: '/docs/guides/design-guidelines/',
link: withBase('/guides/design-guidelines/'),
items: [
{ text: 'Resources', link: '/docs/guides/contributing/design-guidelines/resources' },
{ text: 'Tools', link: '/docs/guides/contributing/design-guidelines/tools' },
{ text: 'Resources', link: withBase('/guides/contributing/design-guidelines/resources') },
{ text: 'Tools', link: withBase('/guides/contributing/design-guidelines/tools') },
],
},
],
@@ -101,7 +110,7 @@ export default defineConfig({
{
text: 'Characters',
icon: 'lucide:scan-face',
link: '/characters/',
link: withBase('/characters/'),
},
] as (DefaultTheme.SidebarItem & { icon?: string })[],
-1
View File
@@ -1 +0,0 @@
WIP