I am new to Hugo and would like to build a simple Website.
I run a website based on a template on my Macbook.
The idea is to change the favicon
I added to the config toml:
favicon = "/img/favicon.ico"
And I added the file “favicon.ico” to the folder:
Still the favicon does not change.
I also tried adding it to
but this did not work neither.
What is my mistake?
A little kick in the right direction would be very much appreciated
Can you share a repository with your code ?
Or at least the config.toml and HTML part where you treat the favicon ?
It is impossible to guess without a crystal ball.
Thanks for your help.
I hoped there could be a more general approach on where to store the favicons.
I don’t (know how to) use git repositories.
The config.toml file does not have a lot of content yet. I am trying to add more lines bit byt bit, trying to understand them.
Favicon was actually the first item and already failed
baseURL = “http://example.com/”
theme = “introduction”
favicon = “/img/favicon.ico” # Path to favicon file
Where would I find the html part that is required for the location of the favicon?
Is this something which is always the same or does it always differ?
It is in your theme in some code/partial
To find it, you can search for
favicon in your editor, so you’ll get the code.
You also can try
favicon = “img/favicon.ico” to make it relative
Sometimes it is also that the browser do not refresh the favicon.
Can you try with an other browser or in privacy mode ?
Thanks, opening it in another browser actually changed the favicon in the browser.
Now I just can’t track anymore, what actually caused the change
When I look for “code” folders, I find 4 of the in the theme.
Let’s see … Not as simple to use as I thought
It is not the code. But your browser is caching your first favicon.
If you have Chrome/Brave you can try in dev mode and reload and clear cache
I know that, thanks.
I mean that i don’t if adding the favicon to
caused the favicon to change.
Can’t reproduce the change neither.
Best practice is :
- do not change the theme folder.
- If you want to change something, just add it in your root folder (but mimic the path). So your changed file will be treated instead of the theme one.
For he favicon
/static/img is the right thing to do. And do not change the theme
Thanks, that was the answer I was looking for.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.