Search code examples
jekyll

My Jekyll Post Is Throwing A 404 Error In Production


I am using Jekyll and GitHub Pages to host a blog. However, I have the following issue:

I have created a new post in the _posts folder and then built the site locally using the following command: bundle exec jekyll serve. When I access the site on localhost:4000, I can click on the link to the new post and access it.

When I commit my changes to the master branch on this repo, it builds without any errors. However, when I now click on the new post, it throws a 404 Error saying the page could not be found.

How do I resolve this error?


Solution

  • You've hardcoded a link.

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

    must be :

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

    Note : Your index.html looks like it is integrally hard coded. This is not how jekyll is supposed to be used. This can quickly lead to unmaintainable code base.