From a4ee6ef43589fbeb3b73658cd8c60c6c9ee7dab4 Mon Sep 17 00:00:00 2001 From: ccbikai Date: Sun, 22 Dec 2024 19:24:32 +0800 Subject: [PATCH] feat: enhance channel favicon with dynamic resizing Implements dynamic favicon handling using wsrv.nl image service: - Resizes channel avatar to 64x64 - Applies circular mask for consistent appearance - Ensures HTTPS compatibility by stripping protocol - Falls back to default favicon when no avatar exists Improves visual consistency across different platforms and scales --- src/layouts/base.astro | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/layouts/base.astro b/src/layouts/base.astro index 6d6c281f..22262e48 100644 --- a/src/layouts/base.astro +++ b/src/layouts/base.astro @@ -37,7 +37,14 @@ const seoParams = { }, }, extend: { - link: [{ rel: 'icon', href: channel?.avatar ? channel?.avatar : '/favicon.svg' }], + link: [ + { + rel: 'icon', + href: channel?.avatar + ? `https://wsrv.nl/?w=64&h=64&fit=cover&mask=circle&url=ssl:${channel?.avatar?.replace(/^https?:\/\//, '')}` + : '/favicon.svg', + }, + ], }, }