Blog post not displaying

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.

The date of your post is probably in the future.

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

Just wondering here…should it be year-month-day or year-day-month?

According to Posts | Jekyll • Simple, blog-aware, static sites it’s year-month-day

is it a draft? can you post a link to the repo?

locally what is in your site folder if you do jekyll build instead of serve?

It is not a draft

can you post a link to the repo?
this is hosted on a VPS that I am using … you mean you want access to that ?

locally what is in your site folder if you do jekyll build instead of serve?
sorry, don’t understand your question

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?

correct … its not on GH.

when I do ‘bundle exec jekyll build’, the post does not show up in ./_site/2021/08

yes I have jekyll installed on my VPS, and just using port 4000 to view the site with the serve command before I go to production build

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 :slight_smile:

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:

  1. 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
  2. As mentioned earlier, make sure the filename is in the form of yyyy-mm-dd
  3. 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
  4. Make sure the filename has an extension of .md or .markdown, not .html or something similar. It should look like this:
  5. 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...
  1. 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
  2. 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 hope this helps!


This SO post has some additional things to check.

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.

jekyll build --verbose

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?

1 Like