指向使用jekyll无法在github项目页面中工作的资产中的文件的链接
我正在使用jekyll建立一个github项目页面博客,指向我的指向使用jekyll无法在github项目页面中工作的资产中的文件的链接,jekyll,assets,github-pages,Jekyll,Assets,Github Pages,我正在使用jekyll建立一个github项目页面博客,指向我的资产的链接无法正常工作。我也看到过其他几个类似问题的帖子,但似乎没有一篇适合我的情况。在标记为重复之前,请检查我是否尚未尝试其他问题中建议的解决方案 尝试将图像添加到我的帖子时,图像不会显示。当我试图链接到pdf进行下载时,我得到了一个死链接(如http://nikosdaniilidis/github.io/assets/all-pdf/Daniilidis2014-surface-noise.pdf) 我尝试了以下配置: 案例0
资产的链接无法正常工作。我也看到过其他几个类似问题的帖子,但似乎没有一篇适合我的情况。在标记为重复之前,请检查我是否尚未尝试其他问题中建议的解决方案
尝试将图像添加到我的帖子时,图像不会显示。当我试图链接到pdf进行下载时,我得到了一个死链接(如http://nikosdaniilidis/github.io/assets/all-pdf/Daniilidis2014-surface-noise.pdf
)
我尝试了以下配置:
案例0
在\u config.yml
baseurl: "/projectname"`
url: "http://username/github.io/projectname"
baseurl: "/projectname"`
url: "http://username/github.io"
baseurl: "/projectname"`
url: "http://username/github.io"
在\u posts/一些post
![image here]({{ site.url }}/assets/path/to/image.png)
[pdf here]({{ site.url }}/assets/path/to/some.pdf)
![image here]({{ site.baseurl }}/assets/path/to/image.png)
[pdf here]({{ site.baseurl }}/assets/path/to/some.pdf)
![image here]({{ site.baseurl }}{{post.url}}/assets/path/to/image.png)
[pdf here]({{ site.baseurl }}{{post.url}}/assets/path/to/some.pdf)
结果链接路径(不工作):
案例1
在\u config.yml
baseurl: "/projectname"`
url: "http://username/github.io/projectname"
baseurl: "/projectname"`
url: "http://username/github.io"
baseurl: "/projectname"`
url: "http://username/github.io"
在\u posts/一些post
![image here]({{ site.url }}/assets/path/to/image.png)
[pdf here]({{ site.url }}/assets/path/to/some.pdf)
![image here]({{ site.baseurl }}/assets/path/to/image.png)
[pdf here]({{ site.baseurl }}/assets/path/to/some.pdf)
![image here]({{ site.baseurl }}{{post.url}}/assets/path/to/image.png)
[pdf here]({{ site.baseurl }}{{post.url}}/assets/path/to/some.pdf)
结果链接路径(不工作):
案例2
在\u config.yml
baseurl: "/projectname"`
url: "http://username/github.io/projectname"
baseurl: "/projectname"`
url: "http://username/github.io"
baseurl: "/projectname"`
url: "http://username/github.io"
在\u posts/一些post
![image here]({{ site.url }}/assets/path/to/image.png)
[pdf here]({{ site.url }}/assets/path/to/some.pdf)
![image here]({{ site.baseurl }}/assets/path/to/image.png)
[pdf here]({{ site.baseurl }}/assets/path/to/some.pdf)
![image here]({{ site.baseurl }}{{post.url}}/assets/path/to/image.png)
[pdf here]({{ site.baseurl }}{{post.url}}/assets/path/to/some.pdf)
结果链接路径(不工作):
我已经没有主意了,非常感谢你的帮助!下面是结果(查看post下的内容,当前使用上述最后一个案例进行了配置)
谢谢Github页面用户存储库url模式是username.Github.io
而不是username/Github.io
尝试:
非常感谢。天哪,我已经看了这么久了,在我眼前看不见……我很高兴这是一件如此琐碎的事情!你的问题很完美:-搜索解决方案-给出一个代码库非常好的问题!无法将此与kasper jekyll主题一起使用。我猜不是所有的主题都支持项目模式。或者他们会这样做,但你必须重写一些流畅的语法来使用baseurl等。kasper主题在一个新的组织网站上一开始就发挥了作用。