Add site icons for favicon and home screen shortcuts

Include favicon, apple-touch-icon, web manifest, and navbar logo for bookmarks and PWA-style shortcuts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-05 17:11:36 +08:00
parent 4a0851628a
commit df619a5d8e
7 changed files with 63 additions and 1 deletions
+10
View File
@@ -25,7 +25,17 @@ export default defineConfig({
],
cleanUrls: true,
ignoreDeadLinks: true,
head: [
['link', { rel: 'icon', href: '/favicon.svg', type: 'image/svg+xml' }],
['link', { rel: 'icon', href: '/favicon.png', type: 'image/png', sizes: '512x512' }],
['link', { rel: 'apple-touch-icon', href: '/apple-touch-icon.png', sizes: '180x180' }],
['link', { rel: 'manifest', href: '/site.webmanifest' }],
['meta', { name: 'theme-color', content: '#0f3460' }],
['meta', { name: 'apple-mobile-web-app-title', content: '道德经' }],
['meta', { name: 'application-name', content: 'DAO DE JING' }],
],
themeConfig: {
logo: { src: '/favicon.png', width: 24, height: 24 },
nav: [
{ text: '首页', link: '/' },
{ text: '五行', link: '/金、木、水、火、土 - 五行/' },
Binary file not shown.
BIN
View File
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" role="img" aria-label="S">
<defs>
<linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#0f3460"/>
<stop offset="100%" stop-color="#1a1a2e"/>
</linearGradient>
</defs>
<rect width="512" height="512" rx="112" fill="url(#bg)"/>
<circle cx="256" cy="256" r="196" fill="none" stroke="#d4af37" stroke-width="10" opacity="0.85"/>
<text x="256" y="292" text-anchor="middle" font-size="220" font-family="'KaiTi','STKaiti','SimSun',serif" fill="#f5f5f5">S</text>
</svg>

After

Width:  |  Height:  |  Size: 590 B

+22
View File
@@ -0,0 +1,22 @@
{
"name": "DAO DE JING",
"short_name": "道德经",
"description": "传统文化典籍资料库",
"start_url": "/",
"display": "standalone",
"background_color": "#1a1a2e",
"theme_color": "#0f3460",
"icons": [
{
"src": "/apple-touch-icon.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any maskable"
},
{
"src": "/favicon.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
+8 -1
View File
@@ -31,4 +31,11 @@ resetPublicDir()
copyDir(path.join(root, 'assets'), path.join(publicDir, 'assets'))
copyDir(path.join(root, 'images'), path.join(publicDir, 'images'))
console.log('[prepare-public] assets 与 images 已同步到 .vitepress/public')
const siteDir = path.join(root, 'assets', 'site')
if (fs.existsSync(siteDir)) {
for (const file of fs.readdirSync(siteDir)) {
fs.copyFileSync(path.join(siteDir, file), path.join(publicDir, file))
}
}
console.log('[prepare-public] assets、images 与站点图标已同步到 .vitepress/public')
+6
View File
@@ -3,6 +3,12 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#0f3460" />
<meta name="apple-mobile-web-app-title" content="道德经" />
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
<link rel="icon" href="/favicon.png" type="image/png" sizes="512x512" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="manifest" href="/site.webmanifest" />
<title>登录 · DAO DE JING</title>
<style>
* { box-sizing: border-box; }