网站图标
🌐 Favicon
Page summary:通过替换项目根目录下的
favicon.png文件或配置strapi::favicon中间件来替换 Strapi 管理面板的 favicon,然后重新构建应用。🌐 Replace the Strapi admin panel favicon by replacing the
favicon.pngfile at the project root or configuring thestrapi::faviconmiddleware, then rebuild the app.
Strapi 的 管理面板 会在多个地方显示其品牌标识,包括 徽标 和网站图标。替换这些图片可以让你将界面和应用与你的身份相匹配。
🌐 Strapi's admin panel displays its branding on various places, including the logo and the favicon. Replacing these images allows you to match the interface and application to your identity.
更换网站图标有两种方法:
🌐 There are 2 approaches to replacing the favicon:
-
替换 Strapi 项目根目录下的
favicon.png文件 -
用以下代码编辑
strapi::favicon中间件配置:/config/middlewares.js// …
{
name: 'strapi::favicon',
config: {
path: 'my-custom-favicon.png',
},
},
// …
完成后,通过在终端运行 yarn build && yarn develop 来重建、启动并重新访问你的 Strapi 应用。
🌐 Once done, rebuild, launch and revisit your Strapi app by running yarn build && yarn develop in the terminal.
确保清除缓存的收藏夹图标。它可能缓存于你的网页浏览器中,也可能缓存于像 Cloudflare 的 CDN 这样的域名管理工具中。
🌐 Make sure that the cached favicon is cleared. It can be cached in your web browser and also with your domain management tool like Cloudflare's CDN.