网站图标
¥Favicon
Strapi 的 管理面板 在多个位置显示其品牌标识,包括 logo 和网站图标。替换这些图片可以让你将界面和应用与你的身份相匹配。
¥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.
要替换图标:
¥To replace the favicon:
-
如果
/src/admin/extensions/
文件夹尚不存在,请创建该文件夹。¥Create a
/src/admin/extensions/
folder if the folder does not already exist. -
将你的网站图标上传到
/src/admin/extensions/
。¥Upload your favicon into
/src/admin/extensions/
. -
将 Strapi 应用根目录中现有的 favicon.png|ico 文件替换为自定义
favicon.png|ico
文件。¥Replace the existing favicon.png|ico file at the Strapi application root with a custom
favicon.png|ico
file. -
使用以下内容更新
/src/admin/app.[tsx|js]
:¥Update
/src/admin/app.[tsx|js]
with the following:./src/admin/app.jsimport favicon from "./extensions/favicon.png";
export default {
config: {
// replace favicon with a custom icon
head: {
favicon: favicon,
},
},
}; -
通过在终端中运行
yarn build && yarn develop
来重建、启动并重新访问你的 Strapi 应用。¥Rebuild, launch and revisit your Strapi app by running
yarn build && yarn develop
in the terminal.
可以使用相同的过程来替换登录徽标(即 AuthLogo
)和菜单徽标(即 MenuLogo
)(参见 徽标定制文档)。
¥This same process may be used to replace the login logo (i.e. AuthLogo
) and menu logo (i.e. MenuLogo
) (see logos customization documentation).
确保清除缓存的图标。它可以缓存在你的 Web 浏览器中,也可以使用你的域管理工具(例如 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.