diff --git a/CLAUDE.md b/CLAUDE.md index efcc665..72c3cd7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -75,7 +75,9 @@ src/ └── consts.ts (SITE_TITLE, WORLDS, ANALYTICS, CATEGORY_COLORS, plural()) public/ -├── favicon.svg +├── favicon.svg (брендовый знак на тёмном фоне, оптимизирован под 16-32px) +├── favicon.ico (32×32 PNG-in-ICO, генерируется из favicon.svg) +├── apple-touch-icon.png (180×180 для iOS home screen) ├── logo.svg, logo-mark.svg ├── og-image.png (1200×630 для расшаривания в TG/VK/Twitter) ├── og-image.svg (исходник) @@ -86,7 +88,8 @@ public/ scripts/ ├── migrate-wp.mjs (одноразовый: _wp-export.json → src/content/*.md) -└── build-og-image.mjs (sharp → public/og-image.png из SVG) +├── build-og-image.mjs (sharp → public/og-image.png из SVG) +└── build-favicon.mjs (sharp → public/favicon.ico + apple-touch-icon.png из favicon.svg; `npm run build:favicon`) Dockerfile (multi-stage: node:22-alpine builds → nginx:1.29-alpine serves) nginx.conf (gzip, кэш _astro/ 1y, MIME application/rss+xml для feed) diff --git a/package.json b/package.json index ee4b0a9..96a4466 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "preview": "astro preview", "astro": "astro", "migrate": "node scripts/migrate-wp.mjs", - "indexnow": "node scripts/indexnow.js" + "indexnow": "node scripts/indexnow.js", + "build:favicon": "node scripts/build-favicon.mjs" }, "dependencies": { "@astrojs/rss": "^4.0.12", diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png new file mode 100644 index 0000000..32c973b Binary files /dev/null and b/public/apple-touch-icon.png differ diff --git a/public/favicon.ico b/public/favicon.ico index 7f48a94..bba6823 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/favicon.svg b/public/favicon.svg index f157bd1..f9cb2d7 100644 --- a/public/favicon.svg +++ b/public/favicon.svg @@ -1,9 +1,16 @@ - - - + + + + + + + + + + + + + + + diff --git a/scripts/build-favicon.mjs b/scripts/build-favicon.mjs new file mode 100644 index 0000000..95156c4 --- /dev/null +++ b/scripts/build-favicon.mjs @@ -0,0 +1,28 @@ +#!/usr/bin/env node +// Генерирует public/favicon.ico (32x32 PNG-in-ICO, как у Astro по умолчанию) +// и public/apple-touch-icon.png (180x180) из public/favicon.svg. +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import sharp from 'sharp'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const ROOT = path.resolve(__dirname, '..'); + +const svgPath = path.join(ROOT, 'public/favicon.svg'); +const svg = fs.readFileSync(svgPath); + +const targets = [ + { out: 'public/favicon.ico', size: 32 }, + { out: 'public/apple-touch-icon.png', size: 180 }, +]; + +for (const { out, size } of targets) { + const dst = path.join(ROOT, out); + await sharp(svg, { density: 384 }) + .resize(size, size) + .png({ compressionLevel: 9 }) + .toFile(dst); + const kb = (fs.statSync(dst).size / 1024).toFixed(1); + console.log(`wrote ${out} (${size}x${size}) — ${kb} KB`); +} diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index f2ec911..5f25744 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -69,6 +69,8 @@ const jsonLd = [ + +