|
1 | 1 | import { defineConfig } from 'vitepress'; |
2 | | -import { description, name, title, version } from '../../package.json'; |
| 2 | +import { description, name, title } from '../../package.json'; |
3 | 3 |
|
4 | 4 | const isProd = process.env.NODE_ENV === 'production'; |
| 5 | +// `name` should be the name of the repository |
| 6 | +const base = isProd ? `/${name}/` : ''; |
5 | 7 |
|
6 | 8 | // https://vitepress.dev/reference/site-config |
7 | 9 | export default defineConfig({ |
8 | 10 | title, |
9 | 11 | description, |
10 | | - head: [['link', { rel: 'icon', href: '/icon-dark.svg' }]], |
| 12 | + head: [ |
| 13 | + ['link', { rel: 'icon', type: 'image/svg+xml', href: `${base}icon-dark.svg` }], |
| 14 | + // Fallback for browsers that don't support SVG favicons |
| 15 | + ['link', { rel: 'alternate icon', href: `${base}favicon.ico` }], |
| 16 | + ], |
11 | 17 | themeConfig: { |
12 | 18 | // https://vitepress.dev/reference/default-theme-config |
13 | 19 | logo: { |
14 | | - dark: '/icon-dark.svg', |
15 | | - light: '/icon-light.svg', |
| 20 | + dark: `${base}icon-dark.svg`, |
| 21 | + light: `${base}icon-light.svg`, |
16 | 22 | width: 24, |
17 | 23 | height: 24, |
18 | 24 | }, |
@@ -74,6 +80,5 @@ export default defineConfig({ |
74 | 80 | text: 'Edit this page on GitHub', |
75 | 81 | }, |
76 | 82 | }, |
77 | | - // `name` should be the name of the repository |
78 | | - base: isProd ? `/${name}/` : undefined, |
| 83 | + base, |
79 | 84 | }); |
0 commit comments