Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll post not generated

Tags:

jekyll

I am trying to add a new post to my Jekyll site, but I cannot see it on the generated pages when I run jekyll serve.

What are some common reasons for a Jekyll post to not be generated?

like image 738
aronisstav Avatar asked Jun 03 '15 15:06

aronisstav


3 Answers

  • The post is not placed in the _posts directory.
  • When you change the collections_dir in your config from . (default) to my_col_folder all your posts have to move as well below my_col_folder/_posts jekyll defaults
  • The post has incorrect title. Posts should be named YEAR-MONTH-DAY-title.MARKUP (Note the MARKUP extension, which is usually .md or .markdown)
  • The post's date is in the future. You can make the post visible by setting future: true in _config.yml (documentation)
  • The post has published: false in its front matter. Set it to true.
  • The title contains a : character. Replace it with &#58. Works in jekyll 3.8.3 (and probably in other 'recent' releases).
like image 140
aronisstav Avatar answered Nov 19 '22 15:11

aronisstav


You can use jekyll build --verbose to view build process in detail.

Exmaple output:

  Logging at level: debug
Configuration file: /home/fangxing/fffx.github.io/_config.yml
  Logging at level: debug
         Requiring: jekyll-archives
         Requiring: jekyll-livereload
         Requiring: kramdown
            Source: /home/fangxing/fffx.github.io
       Destination: /home/fangxing/fffx.github.io/_site
 Incremental build: enabled
      Generating... 
       EntryFilter: excluded /Gemfile
       EntryFilter: excluded /Gemfile.lock
           Reading: _posts/2018-01-14-new-post.md
           Reading: _posts/2014-01-01-example-content.md
           Reading: _posts/2014-01-02-introducing-lanyon.md
           Reading: _posts/2017-11-21-welcome-to-jekyll.markdown
           Reading: _posts/2018-01-14-boot-android-on-charge.md
           Reading: _posts/2013-12-31-whats-jekyll.md
          Skipping: _posts/2018-01-14-boot-android-on-charge.md has a future date
        Generating: Jekyll::Archives::Archives finished in 0.000122873 seconds.
        Generating: JekyllFeed::Generator finished in 0.000468846 seconds.
        ...

from the log I found jeklly skipped 2018-01-14-boot-android-on-charge.md because it has a future date.

like image 23
fangxing Avatar answered Nov 19 '22 16:11

fangxing


One possible reason is that the date specified in the front matter does not contain a time zone offset, in which case it defaults to UTC, not the time zone of the local machine as you might expect. I wasted an hour on this until UTC "caught up" with my current local time zone, BST.

I haven't found a definitive answer to this but I think the date in the front matter must be given in UTC with a timezone offset (which defaults to zero if omitted).

So date: 2018-05-03 12:34:27 is in UTC irrespective of where in the world you are, and irrespective of the timezone setting in _config.yml.

So be careful to specify datetimes like this:

date: 2018-05-03 12:34:27 +0100
like image 9
starfry Avatar answered Nov 19 '22 16:11

starfry