我正在使用 jekyll 设置一个 github 项目页面博客,但指向我的 assets
文件的链接无法正常工作。我看过其他几个有类似问题的帖子,但似乎没有一个适用于我的情况。在标记为重复之前,请检查我是否还没有尝试过其他问题中建议的解决方案。
尝试向我的帖子添加图片时,图片不显示。当我尝试链接到 pdf 以供下载时,我得到一个死链接(如 http://nikosdaniilidis/github.io/assets/all-pdf/Daniilidis2014-surface-noise.pdf
)
我尝试了以下配置:
案例0
在_config.yml
baseurl: "/projectname"`
url: "http://username/github.io/projectname"
在_posts/some-post
![image here]({{ site.url }}/assets/path/to/image.png)
[pdf here]({{ site.url }}/assets/path/to/some.pdf)
生成的链接路径(不工作):
http://nikosdaniilidis/github.io/altblog/assets/all-pdf/Daniilidis2014-surface-noise.pdf
案例一
在_config.yml
baseurl: "/projectname"`
url: "http://username/github.io"
在_posts/some-post
![image here]({{ site.baseurl }}/assets/path/to/image.png)
[pdf here]({{ site.baseurl }}/assets/path/to/some.pdf)
生成的链接路径(不工作):
http://nikosdaniilidis/github.io/assets/all-pdf/Daniilidis2014-surface-noise.pdf
案例2
在_config.yml
baseurl: "/projectname"`
url: "http://username/github.io"
在_posts/some-post
![image here]({{ site.baseurl }}{{post.url}}/assets/path/to/image.png)
[pdf here]({{ site.baseurl }}{{post.url}}/assets/path/to/some.pdf)
生成的链接路径(不工作):
http://nikosdaniilidis/github.io/assets/all-pdf/Daniilidis2014-surface-noise.pdf
我的想法已经用完了,非常感谢您的帮助!这是 repo , 这是结果 page (查看 Test links and other asset material 帖子,当前配置了上述最后一种情况)。
谢谢
最佳答案
Github 页面用户存储库 url 模式是 username.github.io
而不是 username/github.io
尝试:
url: http://nikosdaniilidis.github.io
baseurl: /altblog
关于jekyll - 使用 jekyll 链接到 Assets 中的文件在 github 项目页面中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26393333/