I recently started a blog using Jekyll. I have two posts live, but my latest blog post will not display.
When I test my site using: bundle exec jekyll serve --host ip_address the post displays correctly when I go to ip_address:4000.
But when I go to production using: JEKYLL_ENV=production bundle exec jekyll build, even though I get no errors, when I visit my live blog the post does not show up.
When I look int the html folder for the blog, I notice that Jekyll has not created the html file for the post from the markdown file.
Afraid not … I did see that suggestion in another thread and double checked. Both the date in the front matter for the post and the markdown filename are 2021-08-09
so you don’t have it version controlled on GH where we could see the repo? I don’t/won’t login to a VPS so don’t post anything for that.
Locally you said it was fine when you do jekyll serve - what if you do bundle execute jekyll build instead - in the site folder does the post show up? build will build the site but does not open up a webserver for you to see the site. How are you building it on the vps? you have jekyll installed on it?
Perhaps you can share the location, filename, and contents (or initial contents with the YAML front matter) so we can help you identify the problem? Most people put their website up on GitHub and then build from there, which is why you are being asked to share your repo. We can usually pull it down, take a look, and solve the problem for you.
If this continues and you need further help, it might be useful for you to – even temporarily – copy your Jekyll folder up to GitHub as a public repo, share the link, and we can take a look. If you need help with that, let us know. I agree with @rdyar; please do not share your VPS details with us as that would open up a lot of security concerns for you and anyone else involved
The reasons for a post not showing up are often super basic, and you don’t even notice it at first. Here are all the checks I am used to doing:
Make sure the file is in the ./posts folder. Also, sometimes people place the content in the ./_site folder accidentally, so do make sure it is in the root _posts folder, which I think you are doing
As mentioned earlier, make sure the filename is in the form of yyyy-mm-dd
Make sure the filename contains additional text after the date, without spaces, like this: 2020-05-31-hello-world-sample-post. Technically, I am not sure if you can use spaces, but if you have any, remove them and replace them with dashes
Make sure the filename has an extension of .md or .markdown, not.html or something similar. It should look like this: 2020-05-31-hello-world-sample-post.markdown
-or- 2020-05-31-hello-world-sample-post.md
At minimum, Make sure the front mater has a layout and a title, like this:
---
layout: default
title: This is my Hello World sample blog post
---
Welcome to my very first post! I am excited to share...
If your YAML front matter contains any other content, try temporarily removing it. Maybe there is a problem. For example, just use the example I share above, where you just have the layout and the title
While I doubt this is the problem, try deleting the front matter and hand-typing it from scratch just to be sure there aren’t some strange characters in there
I have encountered your issue before. It is almost always not naming the filename correctly and with the proper extension, or I accidentally put the file in the wrong location.
I’ve seen future dated posts being a common problem as the time on the server building your site may differ from your local machine. Enabling future: true in _config.yml gets around that.
Using the verbose flag can also help debug as it will inform you if a post is being skipped for some reason.
tks @BillRaymond for all the suggestions. tried them all, to no avail … and to @mmistakes fo rthe --verbose tag tip.
I am happy to report that I found the problem (tks to your messages around being really careful about how you type commands/tags etc.
When I was copying the files from ‘_site/’ folder following the ‘build’ command I was using ‘sudo rsync -av -site/ /var/www/html/’ instead of ‘…_site/ …’. Strange though, that even though there is no ‘-site’ folder, I did not get an error?