如何在Blogdown中向网页选项卡添加图标 [英] How to add icon to webpage tabs in blogdown
问题描述
如何通过Blogdown网站向其中添加收藏夹图标?我正在使用最小主题.我尝试在config.toml favicon = imgPath
中添加该行,并且还尝试将'favicon.ico'移到静态文件夹中,但是都没有起作用.
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.
推荐答案
如果您在根目录中有一个名为favicon.ico
的文件,则大多数浏览器都将使用它.最简单的方法是在static
目录中添加favicon.ico
(因此,Hugo会将其复制到根目录),请参见
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在<head>
元素中声明.在minimal
主题中,<head>
元素在 header.html 文件中定义. br>
如您所见,minimal
主题不提供对favicon的支持.
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.
首先,检查您是否有layouts/partials/header.html
文件.
如果此文件不存在,请将themes/minimal/layouts/partials/header.html
文件复制到layouts/partials
目录(您可能必须创建此目录).
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).
您必须修改layouts/partials/header.html
文件.
打开<head>
标签后添加:
You have to modify the layouts/partials/header.html
file.
Add after opening <head>
tag:
<link rel="icon" type="image/png" href="{{ "imgPath" | relURL }}">
这篇关于如何在Blogdown中向网页选项卡添加图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!