html - 将 jekyll 网站发布到 github pages

标签 html css github jekyll github-pages

我用 jekyll 建立了自己的网站并将其上传到 git 但我遇到了问题。 我在 youtube 上遵循了有关如何上传网站的指南:https://www.youtube.com/watch?v=fqFjuX4VZmU&list=PLLAZ4kZ9dFpOPV5C5Ay0pHaa0RJFhcmcB&index=19

这是实际网站的链接:https://linus345.github.io/portfolio/

这里是 github 存储库的链接: https://github.com/Linus345/portfolio

该网站位于分支 gh-pages 上,您希望看到的错误是:

Error 404 page not found

我该怎么做才能解决这个问题?如果您需要更多信息,请发表评论。

编辑: 我怀疑永久链接/链接可能存在一些问题,因此它不起作用,但我无法弄清楚。

最佳答案

YouTube 视频中使用的命令是:

git push origin gh-pages

这将创建一个 gh-pages branch ,但即使是你的主分支在这里也应该足够了。 (自 2016 年 Aughist 以来,以及新的“Simplified Publication”)

但是,您的 Assets URL 是在绝对路径中生成的 (/assets/img/Blogit_Logo%20kopia.png)

转化为 404:

https://linus345.github.io/assets/img/Blogit_Logo%20kopia.png

代替

https://linus345.github.io/portfolio/assets/img/Blogit_Logo%20kopia.png

参见“Customizing CSS and HTML in your Jekyll theme”和example repo minima .

关于html - 将 jekyll 网站发布到 github pages,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48482008/

相关文章:

html - 如何在 "auto-expand"CSS 网格单元居中时填充可用空间?

Jquery - 使用数组内容填充下拉框

javascript - 如何从 Angular5 组件 mydaterangepicker 中删除 "position: absolute"?

git - 如何在 GitHub 上从 master 创建开发分支

r - 从 GitHub 上的 R 包下载 vignettes (Rmd)?

javascript - 背景动画流畅循环

javascript - 将图像或 div 设置为背景

Javascript 元素折叠不起作用

css - 更改默认 CSS 类

GitHub:使用机器人阅读 PR 并对该内容进行操作