[solved] Only one post read from _posts

Hello. I’m new to jekyll and have a problem with posts : only the las one (by name’s date) is considered by the builder (4.2.2)

I have the 2 files in _post:

$ ls -l _posts/
total 8
-rw-r--r-- 1 bastien bastien 1571  6 avril 16:23 2022-04-05-c-est-reparti.md
-rw-r--r-- 1 bastien bastien 1580  6 avril 16:52 2022-04-06-le-cinquantieme.md

during build --verbose, I have a line for the first one ; but not for the second :

           Reading: /_layouts/default.html
           Reading: /_layouts/home.html
           Reading: /_layouts/page.html
           Reading: /_layouts/post.html
       EntryFilter: excluded /Gemfile.lock
       EntryFilter: excluded /.jekyll-cache
       EntryFilter: excluded /Gemfile
           Reading: _posts/2022-04-05-c-est-reparti.md
           Reading: _posts/2022-04-05-c-est-reparti.md
           Reading: festival/historique-du-festival.md
           Reading: festival/cioff.md

if I move the second to be “before” with mv _posts/2022-04-06-le-cinquantieme.md _posts/2021-04-06-le-cinquantieme.md ; then the build only read it :

       EntryFilter: excluded /Gemfile
           Reading: _posts/2021-04-06-le-cinquantieme.md
           Reading: _posts/2021-04-06-le-cinquantieme.md
           Reading: festival/historique-du-festival.md
           Reading: festival/cioff.md

… but the 2022-04-05-c-est-reparti.md is ignored.

strace show both files are stat’ed, but only one is opened

Can anyone give me a pointer on how to make sure all files are processed ?

The source files can be seen here : _posts · master · Bastien Durel / sacres · GitLab

BTW: with a third file, only the first is seen, it’s not a 2-files only problem :confused:

Not quite sure what is happening here. Can you check the title and dates in the YAML front matter for both files and make sure they are not identical? I’m wondering if you copied and pasted, then only changed the filename without modifying the front matter?

If my first theory is wrong, could you share the contents of both files and or share a link to your repo, if it is public?

The dates are in sync with the front matter.

The repo is here : _posts · master · Bastien Durel / sacres · GitLab

is it date related? today is the 6th, try putting the date as something in the past like the 5th.

I tried the 5th, the 4th. I also tried to change the year to 2021.

did you stop and restart jekyll? not sure that would be needed but you never know.

what if you remove the date from the front matter?

I re-started. I removed _site. I ran jekyll clean.

Removing the dates from front matter does not change anything.

After some brute force debugging I found the guilty in the ‘jekyll-language-plugin’ gem.
In the Gemfile, just put an # symbol on that line and build & serve the project again

group :jekyll_plugins do
  # This below is the line to comment
  #gem 'jekyll-language-plugin'

Probably that gem hasn’t been configured and introduces some mistakes in the building process.

@fabiomux Ha! I was just posting that and yes we both came to the same conclusion. However, I do not believe it is the plugin, but the use of the group element in the gemfile. Here is how I fixed the problem:

Change this code in the gemfile from this:

group :jekyll_plugins do
  gem 'jekyll-language-plugin'

To this:

gem 'jekyll-language-plugin'

Make sure you re-run bundle exec jekyll serve --livereload.

If that does not work, delete the gemfile.lock file, run bundle install, and then run bundle update. Then, try running bundle exec jekyll serve --livereload again and you should see all posts.

As mentioned here: Plugins | Jekyll • Simple, blog-aware, static sites the jekyll_plugin group forces to load the wrapped gem at the beginning, putting the gem outside it won’t be loaded unless explicitly configured (I suppose the docs is talking about the :plugin section).

So in that case, having no setup in the _config file, removing the gem from the group should be the same as commenting on it inside the group, but I haven’t investigated further.

Thanks a lot !

I removed the jekyll-language-plugin from the plugin list as it didn’t do what I wanted to do, but I wasn’t aware it can have an effect if left in the Gemfile …

I copied the jekyll_plugin group config from a documentation without knowing its effects :confused:

1 Like