Drupal Favicon Setup Guide: Stop Serving the Blue Drop
If you've ever launched a custom Drupal 10 or 11 site, you know the drill. You spend weeks perfecting the Twig templates, configuring complex Views, and mapping out taxonomy structures. Then, you open Safari to admire your work, and that stubborn blue Drupal water drop is still staring back at you from the tab bar.
Getting rid of that default core icon requires more than just dropping an image into your public directory. Drupal's aggressive caching and theme inheritance make this seemingly simple task surprisingly frustrating. In this drupal favicon setup guide, we will walk through the exact steps to replace the core icon permanently, ensuring your brand looks crisp across all devices in 2026.
Look at how large enterprise teams (like Red Hat or major universities) handle their Drupal platforms. They rarely rely on the admin UI for critical branding assets. Instead, they hardcode a modern SVG directly into their theme layer. We are going to take that exact professional approach.
Why the Default UI Method Fails
Drupal does offer a built-in way to change the favicon. If you navigate to Appearance > Settings > Your Theme, you will find a toggle to uncheck the default shortcut icon and upload a custom one.
I strongly recommend against using this method for production sites.
Why? First, it relies on the managed file system, meaning your icon URL will look something like /sites/default/files/favicon.ico. If you ever migrate databases or lose your files directory, your icon breaks. Second, the UI only accepts a single legacy ICO file, completely ignoring the modern 2026 stack of SVGs and Apple Touch Icons.
The Professional Drupal Favicon Setup Guide
To do this right, we need to bypass the UI and inject our icons directly into the theme. Before we touch any code, generate your modern icon set using Mzu favicondl. You want a crisp SVG and a fallback ICO.
Step 1: Place Files in Your Theme
Instead of the public files directory, store your icons inside your custom theme. Create a dedicated folder for them to keep things organized and version-controlled.
Navigate to /web/themes/custom/your_theme/
Create a directory named icons
Drop your favicon.svg and favicon.ico into this folder.
Step 2: Override html.html.twig
Drupal core controls the <head> output via the html.html.twig template. If your theme doesn't already have this file, copy it from the core system module (/core/modules/system/templates/html.html.twig) into your theme's /templates/layout/ directory.
Open the file. You will see a <head-placeholder token=...> tag. Just below that, hardcode your modern SVG favicon links using Twig's active theme path variable.
This guarantees your icons are deployed with your codebase and never rely on the database state.
Step 3: Remove the Core Attachment
Even with your hardcoded Twig tags, Drupal might still inject its default icon tag via page attachments, causing duplicate tags in your DOM. To strip it out, we use a preprocess hook in your your_theme.theme file.
/**
* Implements hook_page_attachments_alter().
*/
function your_theme_page_attachments_alter(array &$attachments) {
foreach ($attachments['#attached']['html_head_link'] as $key => $value) {
if (isset($value[0]['rel']) && $value[0]['rel'] === 'icon') {
unset($attachments['#attached']['html_head_link'][$key]);
}
}
}
This snippet intercepts the page build process and aggressively strips out any icon links Drupal tries to inject natively, leaving only your clean Twig implementation.
Busting the Drupal Cache
You can make all the code changes in the world, but Drupal won't show them until you clear the cache. The render cache is notoriously stubborn.
Open your terminal and navigate to your project root.
Run drush cr (Cache Rebuild).
If you are using a reverse proxy like Varnish or a CDN like Cloudflare, purge those caches as well.
If you still see the old blue drop, your browser is likely holding onto it. Read our guide on forcing a favicon cache clear to resolve local browser stubbornness.
Common Pitfalls in Drupal 10/11
If your setup is still failing, check these common culprits:
File Permissions: Ensure your /icons/ directory is readable by the web server (usually 755 for directories, 644 for files).
Base Path Issues: If you are running Drupal in a subdirectory, active_theme_path() might need to be prefixed with the base URL.
Theme Inheritance: If you are building a sub-theme (e.g., based on Radix or Olivero), make sure your parent theme isn't injecting its own icons via a higher-priority hook.
Stop fighting the Drupal UI. By moving your icon logic into your theme's codebase, you ensure a stable, version-controlled, and professional brand presence across every browser tab.
Si alguna vez has lanzado un sitio Drupal 10 u 11 personalizado, conoces la rutina. Pasas semanas perfeccionando las plantillas Twig, configurando Views complejas y mapeando estructuras de taxonomía. Luego, abres Safari para admirar tu trabajo, y esa obstinada gota de agua azul de Drupal sigue mirándote desde la barra de pestañas.
Deshacerse de ese icono central por defecto requiere más que simplemente soltar una imagen en tu directorio público. El almacenamiento en caché agresivo de Drupal y la herencia de temas hacen que esta tarea, aparentemente simple, sea sorprendentemente frustrante. En esta drupal favicon setup guide, recorreremos los pasos exactos para reemplazar el icono del núcleo permanentemente, asegurando que tu marca se vea nítida en todos los dispositivos en 2026.
Mira cómo los grandes equipos empresariales (como Red Hat o las principales universidades) manejan sus plataformas Drupal. Rara vez confían en la interfaz de administración para los activos críticos de la marca. En su lugar, codifican un SVG moderno directamente en su capa de temas. Vamos a adoptar exactamente ese enfoque profesional.
Por qué falla el método de la UI por defecto
Drupal ofrece una forma integrada de cambiar el favicon. Si navegas a Appearance > Settings > Your Theme, encontrarás un interruptor para desmarcar el icono de acceso directo por defecto y subir uno personalizado.
Recomiendo encarecidamente no usar este método para sitios en producción.
¿Por qué? Primero, depende del sistema de archivos administrado, lo que significa que la URL de tu icono se verá como /sites/default/files/favicon.ico. Si alguna vez migras bases de datos o pierdes tu directorio de archivos, tu icono se rompe. Segundo, la UI solo acepta un único archivo ICO heredado, ignorando por completo la pila moderna de 2026 de SVGs y Apple Touch Icons.
La Guía Profesional de Configuración de Favicon en Drupal
Para hacer esto bien, necesitamos evitar la UI e inyectar nuestros iconos directamente en el tema. Antes de tocar ningún código, genera tu conjunto de iconos modernos usando Mzu favicondl. Necesitas un SVG nítido y un ICO de respaldo.
Paso 1: Coloca los archivos en tu tema
En lugar del directorio de archivos públicos, almacena tus iconos dentro de tu tema personalizado. Crea una carpeta dedicada para ellos para mantener las cosas organizadas y bajo control de versiones.
Navega a /web/themes/custom/your_theme/
Crea un directorio llamado icons
Suelta tu favicon.svg y favicon.ico en esta carpeta.
Paso 2: Sobrescribe html.html.twig
El núcleo de Drupal controla la salida del <head> a través de la plantilla html.html.twig. Si tu tema aún no tiene este archivo, cópialo desde el módulo del sistema central (/core/modules/system/templates/html.html.twig) al directorio /templates/layout/ de tu tema.
Abre el archivo. Verás una etiqueta <head-placeholder token=...>. Justo debajo de eso, codifica tus enlaces de favicon SVG moderno usando la variable de ruta del tema activo de Twig.
Esto garantiza que tus iconos estén controlados por versiones con tu código base y nunca dependan del estado de la base de datos.
Paso 3: Elimina el archivo adjunto del núcleo
Incluso con tus etiquetas Twig codificadas, Drupal aún podría inyectar su etiqueta de icono por defecto a través de los archivos adjuntos de la página, causando etiquetas duplicadas en tu DOM. Para eliminarlo, usamos un hook de preprocesamiento en tu archivo your_theme.theme.
/**
* Implements hook_page_attachments_alter().
*/
function your_theme_page_attachments_alter(array &$attachments) {
foreach ($attachments['#attached']['html_head_link'] as $key => $value) {
if (isset($value[0]['rel']) && $value[0]['rel'] === 'icon') {
unset($attachments['#attached']['html_head_link'][$key]);
}
}
}
Este fragmento intercepta el proceso de construcción de la página y elimina agresivamente cualquier enlace de icono que Drupal intente inyectar de forma nativa, dejando solo tu implementación limpia de Twig.
Borrando la caché de Drupal
Puedes hacer todos los cambios de código del mundo, pero Drupal no los mostrará hasta que borres la caché. La caché de renderizado es notoriamente obstinada.
Abre tu terminal y navega a la raíz de tu proyecto.
Ejecuta drush cr (Cache Rebuild).
Si estás usando un proxy inverso como Varnish o un CDN como Cloudflare, purga esas cachés también.
Si aún ves la vieja gota azul, es probable que tu navegador la esté reteniendo. Lee nuestra guía sobre cómo forzar el borrado de la caché del favicon para resolver la obstinación del navegador local.
Errores comunes en Drupal 10/11
Si tu configuración sigue fallando, revisa estos culpables comunes:
Permisos de archivos: Asegúrate de que tu directorio /icons/ sea legible por el servidor web (generalmente 755 para directorios, 644 para archivos).
Problemas de ruta base: Si estás ejecutando Drupal en un subdirectorio, es posible que active_theme_path() necesite el prefijo de la URL base.
Herencia de temas: Si estás construyendo un subtema (por ejemplo, basado en Radix u Olivero), asegúrate de que tu tema principal no esté inyectando sus propios iconos a través de un hook de mayor prioridad.
Deja de pelear con la UI de Drupal. Al mover la lógica de tu icono a la base de código de tu tema, garantizas una presencia de marca estable, controlada por versiones y profesional en cada pestaña del navegador.
맞춤형 Drupal 10 또는 11 사이트를 구축해 본 개발자라면 이 상황이 익숙할 겁니다. Twig 템플릿을 완벽하게 다듬고, 복잡한 Views를 구성하고, 분류 구조를 매핑하는 데 몇 주를 보냅니다. 그런 다음 작업물을 감상하기 위해 Safari를 열었는데, 탭 표시줄에서 여전히 그 고집스러운 파란색 Drupal 물방울이 당신을 쳐다보고 있습니다.
이 기본 코어 아이콘을 없애는 것은 단순히 public 디렉토리에 이미지를 넣는 것 이상을 요구합니다. Drupal의 강력한 캐싱과 테마 상속으로 인해 이 간단해 보이는 작업이 놀랍도록 실망스러워질 수 있습니다. 이 drupal favicon setup guide에서는 코어 아이콘을 영구적으로 교체하여 2026년의 모든 기기에서 브랜드가 선명하게 보이도록 하는 정확한 단계를 안내합니다.
Red Hat이나 주요 대학과 같은 대규모 엔터프라이즈 팀이 Drupal 플랫폼을 어떻게 처리하는지 살펴보세요. 그들은 중요한 브랜딩 자산을 관리자 UI에 의존하는 일이 거의 없습니다. 대신 최신 SVG를 테마 레이어에 직접 하드코딩합니다. 우리도 바로 그 전문적인 접근 방식을 취할 것입니다.
기본 UI 방식이 실패하는 이유
Drupal은 파비콘을 변경할 수 있는 기본 제공 방법을 제공합니다. Appearance > Settings > Your Theme로 이동하면 기본 바로가기 아이콘을 선택 취소하고 사용자 정의 아이콘을 업로드할 수 있는 토글이 있습니다.
프로덕션 사이트에서는 이 방법을 사용하지 않는 것을 강력히 권장합니다.
이유가 무엇일까요? 첫째, 관리형 파일 시스템에 의존하므로 아이콘 URL이 /sites/default/files/favicon.ico와 같이 됩니다. 데이터베이스를 마이그레이션하거나 files 디렉토리를 잃어버리면 아이콘이 깨집니다. 둘째, 이 UI는 단일 레거시 ICO 파일만 허용하며 SVG 및 Apple Touch Icon과 같은 2026년의 최신 스택을 완전히 무시합니다.
전문적인 Drupal 파비콘 설정 가이드
이 작업을 제대로 수행하려면 UI를 우회하고 아이콘을 테마에 직접 주입해야 합니다. 코드를 건드리기 전에 Mzu favicondl을 사용하여 최신 아이콘 세트를 생성하세요. 선명한 SVG와 폴백 ICO가 필요합니다.
1단계: 테마에 파일 배치
공용 files 디렉토리 대신 사용자 정의 테마 내에 아이콘을 저장하세요. 정리를 위해 전용 폴더를 만들고 버전 관리를 적용합니다.
/web/themes/custom/your_theme/로 이동합니다.
icons라는 디렉토리를 만듭니다.
이 폴더에 favicon.svg와 favicon.ico를 넣습니다.
2단계: html.html.twig 재정의
Drupal 코어는 html.html.twig 템플릿을 통해 <head> 출력을 제어합니다. 테마에 이 파일이 아직 없는 경우 코어 시스템 모듈(/core/modules/system/templates/html.html.twig)에서 테마의 /templates/layout/ 디렉토리로 복사합니다.
파일을 엽니다. <head-placeholder token=...> 태그가 보일 것입니다. 그 바로 아래에 Twig의 활성 테마 경로 변수를 사용하여 최신 SVG 파비콘 링크를 하드코딩합니다.