Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add icon to webpage tabs in blogdown

How can I add a favicon to by blogdown website? I am using the minimal theme. I tried adding the line in the config.toml favicon = imgPath and I also attemped to move 'favicon.ico' to the static folder, but neither has worked.

like image 880
troh Avatar asked Jan 28 '18 20:01

troh


People also ask

How do I make a tab icon?

All modern browsers (tested with Chrome 4, Firefox 3.5, IE8, Opera 10 and Safari 4) will always request a favicon. ico unless you've specified a shortcut icon via <link> . So all you have to do is to make the /favicon. ico request to your website return your favicon.


1 Answers

If you have a file named favicon.ico in root directory, most browsers will use it. The easiest way is to add favicon.ico in static directory (therefore, Hugo will copy it to root directory), see here.

Favicon is declared in <head> element. In minimal theme, the <head> element is defined in header.html file.
As you can see, the minimal theme does not provide support for favicon.

First, check if you have a layouts/partials/header.html file.
If this file does not exist, copy themes/minimal/layouts/partials/header.html file to layouts/partials directory (you may have to create this directory).

You have to modify the layouts/partials/header.html file.
Add after opening <head> tag:

<link rel="icon" type="image/png" href="{{ "imgPath" | relURL }}">
like image 139
RLesur Avatar answered Oct 13 '22 04:10

RLesur