1
votes

I've followed the steps for creating a _post entry in Jekyll. But it keeps saying page not found.

This works fine: http://localhost:4000/blog/2015-12-31-Test

This does not: http://localhost:4000/_posts/2015-01-01-test

I've searched around and haven't found anyone else with this issue.


Update 1: I've also check the _sites folder and the post does technically get built, so the problem is the Jekyll server is failing to locate it after it builds it.

Additional info as requested: 1) Steps followed was from the official documentation here: https://jekyllrb.com/docs/posts/

2) I haven't yet tried uploading it to github to see if it works there as wanted to fix it locally first, however I will do and update this post if that fixes it:

Update2: I have now uploaded but found the same issue: Source file: https://github.com/BadrulAlom/badrulalom.github.io/tree/master/_posts

Result (none of these work): https://badrulalom.github.io/2015-01-01-test https://badrulalom.github.io/_posts/2015-01-01-test https://badrulalom.github.io/_site/2015-01-01-test https://badrulalom.github.io/_site/_posts/2015-01-01-test

3) The _posts folder (I wrote _post in my initial question) is in the root not within the blog folder.

1

1 Answers

2
votes

The folders starting with an underscore are special for Jekyll, they won't be available in the URL as /_foobar, the special folder _posts is where all your posts should go if you don't use any other directory to contain them.

In this case you have the same post in the folder _posts and the folder blog, you should have only one instance of it to avoid any unexpected behaviour.

The default date permalink is defined according to the format /:categories/:year/:month/:day/:title.html so that post should be available in the following urls:

  • http://localhost:4000/blog/2015/12/31/Test.html loading the /blog/_posts/2015-12-31-test.md post.
  • http://localhost:4000/2015/12/31/Test loading the /_post/2015-12-31-test.md post.