Open 4evermaat opened 8 years ago
we ended up editing the user/themes/gravstrap/``base.html.twig
. There is a line here:
<link rel="icon" type="image/png" href="{{ theme_url }}/images/favicon.png" />
or <link rel="icon" type="image/png" href="{{ url('theme://images/favicon.png', true) }}" />
You replace it with the following code:
{% if page.header.custom_favicon %}
<link rel="shortcut icon" type="image/x-icon" href="{{ url('user/pages/images/' ~ page.header.custom_favicon, true) }} " />
{% else %}
<link rel="shortcut icon" type="image/x-icon" href="{{ url('user/pages/images/favicon.ico', true) }}" />
{% endif %}
You create a new folder in the /user/pages/images
and stick all of your favicons there, you can use any file format the browser accepts, including .ico
(usually you use .ico or .png for favicon images) Then if you want to use a custom favicon, on the frontmatter of the page you put this parameter
custom_favicon: whatever.ico
If the custom_favicon
header variable is not there, it will use the default favicon.ico.
You can use theme://images/
if you prefer to keep everything in the images folder
Could you make a PR for that?
I added a PR for it here: https://github.com/giansi/gravstrap-theme/pull/29
I need to know how to edit the favicon image for 1) entire theme and also override for 2) individual pages or folders.
I have one possible solution here but I could not find it there for gravstrap theme