我的 Jekyll Post 在生产中抛出 404 错误

My Jekyll Post Is Throwing A 404 Error In Production

我正在使用 Jekyll 和 GitHub Pages 来托管博客。但是,我有以下问题:

我在 _posts 文件夹中创建了一个新的 post,然后使用以下命令在本地构建站点:bundle exec jekyll serve。当我访问 localhost:4000 上的站点时,我可以单击 link 到新的 post 并访问它。

当我将更改提交到 this repo 上的 master 分支时,它的构建没有任何错误。但是,当我现在单击新的 post 时,它会抛出一个 404 错误,指出找不到该页面。

如何解决此错误?

您已硬编码 link。

/functional/2019/03/02/make-use-of-reduce.html

必须是:

/functional/2019/03/01/make-use-of-reduce.html

注意:您的 index.html 看起来像是整体硬编码。这不是应该使用 jekyll 的方式。这会很快导致无法维护的代码库。