Skip to content

Commit 15641eb

Browse files
committed
docs: Fix favicon
1 parent 336b04d commit 15641eb

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

docs/.vitepress/config.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
import { defineConfig } from 'vitepress';
2-
import { description, name, title, version } from '../../package.json';
2+
import { description, name, title } from '../../package.json';
33

44
const isProd = process.env.NODE_ENV === 'production';
5+
// `name` should be the name of the repository
6+
const base = isProd ? `/${name}/` : '';
57

68
// https://vitepress.dev/reference/site-config
79
export default defineConfig({
810
title,
911
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+
],
1117
themeConfig: {
1218
// https://vitepress.dev/reference/default-theme-config
1319
logo: {
14-
dark: '/icon-dark.svg',
15-
light: '/icon-light.svg',
20+
dark: `${base}icon-dark.svg`,
21+
light: `${base}icon-light.svg`,
1622
width: 24,
1723
height: 24,
1824
},
@@ -74,6 +80,5 @@ export default defineConfig({
7480
text: 'Edit this page on GitHub',
7581
},
7682
},
77-
// `name` should be the name of the repository
78-
base: isProd ? `/${name}/` : undefined,
83+
base,
7984
});

0 commit comments

Comments
 (0)