如何解决:收藏夹图标仅显示在我网站的首页上

时间:2019-05-03 00:45:44

标签: html css jekyll favicon

我的收藏夹图标仅显示在我网站的主页上。

它位于github上我的仓库的根目录中,我分别在head.html_config.yml文件中添加了以下几行。

我尝试了多个路径和文件名。在检查网站其他页面上的源代码时,似乎在末尾将相对路径与/favicon.png链接。

首页来源指向收藏夹图标。

<link rel="shortcut icon" type="image/png" href="favicon.png">
plugins:
   - jekyll-feed
   - jekyll-seo-tag

这是我的head.html文件:

<head>
   <meta charset="utf-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   {%- seo -%}
   <link rel="stylesheet" href="{{ "/assets/main.css" | relative_url }}">
   <link rel="shortcut icon" type="image/png" href="favicon.png">
   {%- feed_meta -%}
   {%- if jekyll.environment == 'production' and site.google_analytics -%}
     {%- include google-analytics.html -%}
   {%- endif -%}
 </head>

我的收藏夹图标不会显示在网站的每个子页面上吗?

目前,它仅显示在主页上,而不显示在其他任何页面上。

这是我的仓库: https://github.com/Redm0nd/redm0nd.github.io

该网页为www.dylanredmond.me

1 个答案:

答案 0 :(得分:1)

可以通过如下方式在favicon.png之前添加斜杠来解决此问题。

<link rel="shortcut icon" type="image/png" href="/favicon.png">

没有斜杠,favicon.png是相关路径,因此它是从以下路径加载的,但不存在。

http://www.dylanredmond.me/jekyll/update/2019/04/30/favicon.png