3

Despite trying multiple times various favicon location approaches:

  • at theme root

  • at files root

  • uploading the file through admin/appearance/settings

  • typing in a path of manually uploaded icon

always clearing cache afterwards, I cannot get my shortcut icon to show up.

I tried pasting into the browser's address bar the path of the ico file so to force an update, but I got a generic server error that there was no such file at this location. When I looked into the generated source code, I could not see neither my file nor the default drupal icon. So I'm completely lost.

I'm close to modifying the html.tpl.php by pasting the link tag manually or through drupal_add_html_head_link but I'm puzzled because it happened to me for the first time. Any clue what else I could double-check?

  • it should work, try running cron too and check with a different browser to see if it works – Sohail Jan 24 '13 at 20:59
2

Just went through this Drupal favicon mess myself :) Hope this helps:

When I looked into the generated source code, I could not see neither my file nor the default drupal icon.

This is the first problem to solve – getting at least the default blue Drupal drop icon to show again. For this:

  1. There is both a global "Shortcut icon settings: Use the default shortcut icon." setting at admin/appearance/settings and an equivalent one for each theme that can be enabled on that page. In all these forms, tick this setting and save the form. If neither this box is ticked nor a valid path entered into the "Path to custom icon" field of the form whose settings "win" the overwriting, Drupal will interpret this as "do not show any favicon".

  2. Make sure Drupal's default favicon is readable by your webserver user: visiting http://example.com/misc/favicon.ico for your domain should show that icon. If it is not accessible to the web server, Drupal will detect that and not even render a shortcut icon header entry.

  3. Cache clearing should not be necessary, but who knows. If still no favicon shows up, do a drush cc all and check again. Check the HTML source code, not what the browser shows, to prevent issues with the browser cache.

Now that the "blue drop" Drupal default favicon shows up again, let's configure your own one. The surefire way is this:

  1. Navigate to the settings screen admin/appearance/settings/theme-name of your "most-sub-theme" applying to the page where you want your favicon to be in effect. So if you have a theme A, a sub-theme of A called B and a sub-theme of B called C, go to admin/appearance/settings/c.

  2. Click "Shortcut icon settings: Browse" and upload a custom favicon. It will end up in the files root directory of your default site.

  3. Load your site again, and it should show your favicon now, at least in the HTML source. If not, try a full cache clear, though that never helped in my case.

Explanations:

  • Choosing the most-sub-theme. This is necessary because the admin/appearance/settings form is just the global setting for all themes, and values entered here will be overwritten by each theme and sub-theme down the chain of themes. So the setting in the "most-sub-theme" will win. Plus, it seems there is no option to not enter a value into the "Shortcut icon settings": when you keep the "Path to custom icon" field empty, Drupal will not fall back to the theme higher up in the chain, but interpret it as "do not use any favicon".

  • Uploading, not typing in a path. There seems to be a Drupal bug with the "Shortcut icon settings" form: it will only accept typed-in values for the "Path to custom icon" field after uploading an icon before. You can then modify the value in that field and it will modify what favicon is used, but when you delete the value, save the form, enter a new value and save again, no favicon will show up even though the same value worked before.

  • Base path when typing in a filename. If you use the above trick to upload first, then modify the value in the "Path to custom icon" field, also remember that the base path for filenames entered here is the files directory of your default site. So, sites/example.com/files/ from web document root. You can be sure it's the right one by checking that your immediately before uploaded favicon arrived in this directory. (If the referenced file exists, Drupal will also accept without form validation errors if you type in a path starting at document root (like sites/all/themes/my_theme/favicon.png) – but I never could get favicons referenced this way to show up.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.