Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editing favicon image #12

Open
4evermaat opened this issue Mar 13, 2016 · 3 comments
Open

editing favicon image #12

4evermaat opened this issue Mar 13, 2016 · 3 comments

Comments

@4evermaat
Copy link

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

@4evermaat
Copy link
Author

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

@giansi
Copy link
Owner

giansi commented Mar 25, 2016

Could you make a PR for that?

@4evermaat
Copy link
Author

I added a PR for it here: #29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants