I am using Hugo to generate a static site. Where should I put my favicon.ico
file?
4 回答
Putting your favicons in static folder is right. It will be published to public folder once the page is built.
However, using absolute CDN (e.g.: Dropbox) services could be better for page performance.
Static files (like logo image or favicon) goes to the "static" folder If you are using:
- a downloaded template, put it in /static/* of your hugo project (to avoid getting erased when updating it)
- your own tempalte, put it in /themes/themeName/static/*
Both will be accessible with path like: /*
Example : "/static/ico/myico.ico" and "/themes/themeName/static/ico/myico.ico" will be bot accessible by "/ico/myico.ico"
When you use this code in your head:
<link rel="shortcut icon" type="image/png" href="/img/icon-192x192.png">
<link rel="shortcut icon" sizes="192x192" href="/img/icon-192x192.png">
<link rel="apple-touch-icon" href="/img/icon-192x192.png">
... you can put your single icon-192x192.png
in the 'img' folder in the static directory (or at any other place you like as long as you specify the path properly).