在Github Pages Jekyll站点收到404错误资产 [英] Receiving 404 error for assets in Github Pages Jekyll site

查看:189
本文介绍了在Github Pages Jekyll站点收到404错误资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在github页面上建立一个基本的Jekyll站点。目前有问题的网站是:
https://kculmback.github.io/kcfeatures- v2 /



这里是回购:
https://github.com/kculmback/kcfeatures-v2



我的问题是,该网站没有加载图片或我的资产文件夹中的css文件,尽管链接似乎是正确的(据我所知)。



图像链接示例:
kculmback.github.io/kcfeatures-v2/assets/img/Logo.svg(目前无法使用)

以下是图片回购:
github.com/kculmback/kcfeatures-v2/blob/master/assets/img/Logo.svg



这是我的第一次建立一个Jekyll站点,但据我所知道的一切,我可以告诉我已经完成了所有的事情......



这是siteurl /来自我的_config.ym的url设置l文件:

 #服务
网址:http://kculmback.github.io
baseurl:/ kcfeatures-v2

以下是我编写链接到CSS文件的示例:

 < link rel =stylesheethref ={{site.baseurl}} / assets / css / app。 CSS> 

以下是由Github页面呈现的结果链接:

  https://kculmback.github.io/kcfeatures-v2/assets/css/app.css 

任何帮助都将不胜感激!

解决方案

问题是不是url,而是 _config.yml 中排除

 exclude:
- / assets /

以上行告诉Jekyll 排除转换中的目录和文件



所以这个网站是在没有资产目录的情况下生成的,而url是正确的。



您必须从排除列表中删除 资产 并且它可以工作。


I'm attempting to set up a basic Jekyll site on github pages. The site in question currently is: https://kculmback.github.io/kcfeatures-v2/

Here is the repo: https://github.com/kculmback/kcfeatures-v2

My problem is that the site is not loading images or the css files from my assets folder, even though the link seems to be correct (as far as I can tell).

Example link to image: kculmback.github.io/kcfeatures-v2/assets/img/Logo.svg (currently not working)

Here is the image in the repo: github.com/kculmback/kcfeatures-v2/blob/master/assets/img/Logo.svg

This is my first time setting up a Jekyll site but as far as I can tell from everything I've read I've done it all right...

Here is the siteurl/url settings from my _config.yml file:

# Serving
url:     "http://kculmback.github.io"
baseurl: "/kcfeatures-v2"

Here is an example of how I wrote the link to CSS file:

<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/app.css">

And here is the resulting link when rendered by Github Pages:

https://kculmback.github.io/kcfeatures-v2/assets/css/app.css

Any help would be greatly appreciated!

解决方案

The problem is not the url, but what it is excluded in the _config.yml:

exclude:
  - "/assets/"

The above line tells Jekyll to exclude directories and files from the conversion.

So the website is being generated without the assets directory, while the urls are ok.

You have to remove assets from the exclude list and it works.

这篇关于在Github Pages Jekyll站点收到404错误资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆