diff --git a/docusaurus/docs/cms/admin-panel-customization/favicon.md b/docusaurus/docs/cms/admin-panel-customization/favicon.md index 15260117eb..2db95b6b99 100644 --- a/docusaurus/docs/cms/admin-panel-customization/favicon.md +++ b/docusaurus/docs/cms/admin-panel-customization/favicon.md @@ -13,31 +13,23 @@ tags: Strapi's [admin panel](/cms/admin-panel-customization) displays its branding on various places, including the [logo](/cms/admin-panel-customization/logos) and the favicon. Replacing these images allows you to match the interface and application to your identity. -To replace the favicon: - -1. Create a `/src/admin/extensions/` folder if the folder does not already exist. -2. Upload your favicon into `/src/admin/extensions/`. -3. Replace the existing **favicon.png|ico** file at the Strapi application root with a custom `favicon.png|ico` file. -4. Update `/src/admin/app.[tsx|js]` with the following: - - ```js title="./src/admin/app.js" - import favicon from "./extensions/favicon.png"; - - export default { - config: { - // replace favicon with a custom icon - head: { - favicon: favicon, - }, - }, - }; - ``` - -5. Rebuild, launch and revisit your Strapi app by running `yarn build && yarn develop` in the terminal. - -:::tip -This same process may be used to replace the login logo (i.e. `AuthLogo`) and menu logo (i.e. `MenuLogo`) (see [logos customization documentation](/cms/admin-panel-customization/logos)). -::: +There are 2 approaches to replacing the favicon: + +* Replace the `favicon.png` file at the root of a Strapi project +* Edit the [`strapi::favicon` middleware configuration](/cms/configurations/middlewares#favicon) with the following code: + + ```js title="/config/middlewares.js" + // … + { + name: 'strapi::favicon', + config: { + path: 'my-custom-favicon.png', + }, + }, + // … + ``` + +Once done, rebuild, launch and revisit your Strapi app by running `yarn build && yarn develop` in the terminal. :::caution 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. diff --git a/docusaurus/static/llms-code.txt b/docusaurus/static/llms-code.txt index 1fcc6dfe26..23e3157b77 100644 --- a/docusaurus/static/llms-code.txt +++ b/docusaurus/static/llms-code.txt @@ -902,23 +902,18 @@ strapi develop --bundler=webpack Source: https://docs.strapi.io/cms/admin-panel-customization/favicon ## Favicon -Description: Create a /src/admin/extensions/ folder if the folder does not already exist. +Description: Replace the favicon.png file at the root of a Strapi project Edit the strap::favicon` middleware configuration, to replace the existing configuration or create it with the following code: (Source: https://docs.strapi.io/cms/admin-panel-customization/favicon#favicon) -Language: JavaScript -File path: ./src/admin/app.js - -```js - import favicon from "./extensions/favicon.png"; +Language: JSON +File path: /config/middlewares.js - export default { - config: { - // replace favicon with a custom icon - head: { - favicon: favicon, - }, - }, - }; +```json + { + name: 'strapi::favicon', + config: { + path: 'my-custom-favicon.png', + }, ``` diff --git a/docusaurus/static/llms-full.txt b/docusaurus/static/llms-full.txt index f53717b07a..8d0f8bf8b1 100644 --- a/docusaurus/static/llms-full.txt +++ b/docusaurus/static/llms-full.txt @@ -1454,31 +1454,20 @@ Source: https://docs.strapi.io/cms/admin-panel-customization/favicon Strapi's [admin panel](/cms/admin-panel-customization) displays its branding on various places, including the [logo](/cms/admin-panel-customization/logos) and the favicon. Replacing these images allows you to match the interface and application to your identity. -To replace the favicon: +There are 2 approaches to replacing the favicon: -1. Create a `/src/admin/extensions/` folder if the folder does not already exist. -2. Upload your favicon into `/src/admin/extensions/`. -3. Replace the existing **favicon.png|ico** file at the Strapi application root with a custom `favicon.png|ico` file. -4. Update `/src/admin/app.[tsx|js]` with the following: +* Replace the `favicon.png` file at the root of a Strapi project +* Edit the [`strap`::favicon` middleware configuration](/configurations/middlewares#favicon), to replace the existing configuration or create it with the following code: - ```js title="./src/admin/app.js" - import favicon from "./extensions/favicon.png"; - - export default { - config: { - // replace favicon with a custom icon - head: { - favicon: favicon, - }, - }, - }; - ``` - -5. Rebuild, launch and revisit your Strapi app by running `yarn build && yarn develop` in the terminal. + ```js title="/config/middlewares.js" + { + name: 'strapi::favicon', + config: { + path: 'my-custom-favicon.png', + }, + ``` -:::tip -This same process may be used to replace the login logo (i.e. `AuthLogo`) and menu logo (i.e. `MenuLogo`) (see [logos customization documentation](/cms/admin-panel-customization/logos)). -::: +Once done, rebuild, launch and revisit your Strapi app by running `yarn build && yarn develop` in the terminal. :::caution 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.