From 640150ad086efb76663192570fb83b9ad1147ad0 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Wed, 28 Oct 2026 22:37:09 +0100 Subject: [PATCH] Restore the favicon of the old documentation and add bigger icons --- docusaurus.config.ts | 16 ++++++++++++++-- scripts/postbuild.mjs | 5 +++++ static/img/apple-touch-icon.png | Bin 0 -> 433 bytes static/img/favicon.ico | Bin 3626 -> 15086 bytes static/img/favicon.svg | 1 + static/img/icon-192.png | Bin 0 -> 468 bytes static/img/icon-512.png | Bin 0 -> 1565 bytes static/site.webmanifest | 11 +++++++++++ 8 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 static/img/apple-touch-icon.png create mode 100644 static/img/favicon.svg create mode 100644 static/img/icon-192.png create mode 100644 static/img/icon-512.png create mode 100644 static/site.webmanifest diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 758fc75..ce3177e 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -185,8 +185,20 @@ const config: Config = { } satisfies Preset.ThemeConfig, plugins: [ - 'docusaurus-plugin-image-zoom' - ] + 'docusaurus-plugin-image-zoom', + // Icons in addition to the "favicon" above. Unlike the "headTags" option, a plugin knows the base url + // of the locale being built (/ru/, /en/), where the static files are located + (context) => ({ + name: 'site-icons', + injectHtmlTags: () => ({ + headTags: [ + {tagName: 'link', attributes: {rel: 'icon', type: 'image/svg+xml', href: `${context.baseUrl}img/favicon.svg`}}, + {tagName: 'link', attributes: {rel: 'apple-touch-icon', href: `${context.baseUrl}img/apple-touch-icon.png`}}, + {tagName: 'link', attributes: {rel: 'manifest', href: `${context.baseUrl}site.webmanifest`}}, + ], + }), + }), + ], }; export default config; diff --git a/scripts/postbuild.mjs b/scripts/postbuild.mjs index 11afe50..22d463a 100644 --- a/scripts/postbuild.mjs +++ b/scripts/postbuild.mjs @@ -42,6 +42,9 @@ cpSync(join(projectDir, 'root'), buildDir, {recursive: true}); // GitHub Pages only serves the 404.html from the site root copyFileSync(join(buildDir, DEFAULT_PREFIX, '404.html'), join(buildDir, '404.html')); +// Browsers and other clients request /favicon.ico when a page doesn't declare its icons +copyFileSync(join(buildDir, DEFAULT_PREFIX, 'img', 'favicon.ico'), join(buildDir, 'favicon.ico')); + // The site root redirects to the documentation in the browser's language const languagesMap = Object.fromEntries([ ...RUSSIAN_SPEAKING.map((lang) => [lang, DEFAULT_PREFIX]), @@ -55,6 +58,8 @@ writeFileSync(join(buildDir, 'index.html'), ` Ely.by Documentation + + ${locales.map(({prefix, lang}) => ` `).join('\n')}