58

I am using Hugo to generate a static site. Where should I put my favicon.ico file?

4

4 回答 4

66

Put the favicon inside of the static directory. The static directory sits in the root of your hugo site. When you generate your site, the favicon will be copied into public, the root of the generated site.

Directory Structure

于 2017-02-04T17:59:14.147 回答
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.

于 2017-02-16T09:01:12.693 回答
0

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"

于 2021-01-28T17:24:33.483 回答
0

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).

于 2021-11-02T23:18:01.407 回答