I'm trying to ship a favicon with my custom Drupal 8 theme, but I can't figure out how to specify its location relative to my theme's installation location.
Following this answer I've created a
config/install/MY_THEME.settings.yml file containing
favicon: use_default: false path: '/themes/MY_THEME/static/favicon.png'
(I'm keeping all my theme's static files in a
static subdirectory of my theme directory)
This works, but contains a hard-coded reference to the installation location of my theme. Hence, if a user decides to install the theme in
themes/custom instead of in
themes the favicon won't be found.
Therefore I would like to specify a path relative to my theme's root directory or relative to the
MY_THEME.settings.yml file. However, it seems that Drupal uses the server root (
/) as a base when I specify a relative path, so
static/favicon.ico ends up as
/static/favicon.ico which obviously doesn't work.