Jekyll message not created

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

What are some common reasons why a Jekyll message is not generated?

+83
jekyll
Jun 03 '15 at 15:55
source share
7 answers
  • The message does not fit into the _posts directory .
  • The message has an invalid header. Posts should be called YEAR-MONTH-DAY-title.MARKUP (note the MARKUP extension, usually .md or .markdown )
  • Date of publication in the future. You can make the message visible by setting future: true in _config.yml (documentation)
  • Post published: false in front of it. Set this to true .
  • The name contains the symbol : Replace it with : . Works in jekyll 3.8.3 (and probably in other "recent" releases).
+193
Jun 03 '15 at 15:55
source share

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

Exmaple output:

  Logging at level: debug Configuration file: /home/fangxing/fffx.imtqy.com/_config.yml Logging at level: debug Requiring: jekyll-archives Requiring: jekyll-livereload Requiring: kramdown Source: /home/fangxing/fffx.imtqy.com Destination: /home/fangxing/fffx.imtqy.com/_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 magazine I found that jeklly missed 2018-01-14-boot-android-on-charge.md because it has a future date.

+13
Jan 14 '18 at 14:20
source share

Or it could be a browser cache if you are not looking for the _site folder, but directly on the main page of the blog with a list of posts.

+2
Feb 20 '16 at 10:59
source share

I wrote Rspec tests for my blog that express these rules:

 require 'spec_helper' require 'yaml' # Documented at https://jekyllrb.com/news/2017/03/02/jekyll-3-4-1-released/ post_regex = %r!^(?:.+/)*(\d{2,4}-\d{1,2}-\d{1,2})-(.*)(\.[^.]+)$! def date_in_front_matter(date) return date if date.is_a?(Date) return date.to_date if date.is_a?(Time) return Date.parse(date) if date.is_a?(String) end describe 'posts' do Dir.glob("_posts/*md").each do |file| basename = File.basename(file) context basename do front_matter = YAML.load(File.read(file).split(/---/)[1]) it 'filename must match documented post regex' do expect(basename).to match post_regex end it 'date in file name same day as date in front matter' do date_in_file_name = Date.parse(post_regex.match(basename).captures[0]) expect(date_in_front_matter(front_matter['date'])).to eq date_in_file_name end it 'title in front matter should not contain a colon' do expect(front_matter['title']).to_not match /:/ end it 'front matter should not have published: false' do expect(front_matter['published']).to_not be false end end end end 

This may be useful for others, as I wasted a lot of time due to typos in the date, etc.

These tests along with the rest of the Rspec configuration can be seen in context here .

+2
Aug 11 '18 at 10:31
source share

One of the possible reasons is that the date indicated in the preliminary material does not contain a time zone offset, in this case, by default, UTC is used, and not the time zone of the local computer, as you might expect. I spent an hour on this until UTC caught up with my current time zone, BST.

I did not find a definite answer to this question, but I think that the date in the main question should be indicated in UTC with the time zone offset (by default it is zero if it is omitted).

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

So be careful when specifying the date and time:

 date: 2018-05-03 12:34:27 +0100 
+1
May 03 '18 at 12:43
source share

In my message, an error message also did not appear that in my name I used a period, for example. 2017-10-18-test.2.md .
This is not accepted, you should use 2017-10-18-test2.md .

0
Oct 18 '17 at 20:14
source share

Just to add one more reason, when you move an article from _drafts to _post , you sometimes need to remove _site for the article to be regenerated.

In my case, it often happens that _site will not be completely deleted before being re-generated, so a new article will not appear.

Anyway, rm -rf _site and bundle exec jekyll serve works :)

0
May 27 '19 at 6:09
source share



All Articles