sverrirs / jekyll-paginate-v2

Pagination Generator for Jekyll 3 (enhanced replacement for the old built-in jekyll-paginate gem) ⛺
https://rubygems.org/gems/jekyll-paginate-v2
MIT License
519 stars 286 forks source link

Pagination for collection and dir_s_mkdir error #150

Open baszczewski opened 5 years ago

baszczewski commented 5 years ago

I am using this plugin in newest version: 2.1.0. Unfortunately after jekyll serve I've got error:

jekyll 3.8.5 | Error:  File exists @ dir_s_mkdir - /media/data/projects/test/_site/freebies/index.html

Important part of my _config.yml:

plugins:
  - jekyll-paginate-v2

collections:
  freebies:
    output: true
    permalink: /freebies/:path/

pagination:
  enabled: true
  permalink: '/page/:num/'
  sort_reverse: true
  per_page: 3
  trail: 
    before: 2
    after: 2

autopages:
  enabled: true
  collections:
    enabled: true
    title: 'Posts in collection :coll' # :coll is replaced by the collection name
    permalink: '/:coll'

defaults:
  - scope:
      path: ""
      type: "freebies"
    values:
      layout: "freebies-post"

My freebies posts are located in "_freebies" directory (I've got 4 files here - only markdowns). I don't have in my project file described in error log like: "freebies/index.html".

What is weird here is that structure work's until option pagination->per_page is bigger than count of files inside my collection.

Do you have any idea what I can do here?

ashmaroli commented 5 years ago

@baszczewski Hi, can you post the backtrace generated by running bundle exec jekyll build --trace Thanks.

baszczewski commented 5 years ago

Shure @ashmaroli:

Configuration file: /media/data/projects/test/_config.yml
            Source: /media/data/projects/test
       Destination: /media/data/projects/test/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
         AutoPages: Generating tags pages
         AutoPages: Generating categories pages
         AutoPages: Generating collections pages

        Pagination: Complete, processed 1 pagination page(s)
Traceback (most recent call last):
    27: from /usr/local/bin/jekyll:23:in `<main>'
    26: from /usr/local/bin/jekyll:23:in `load'
    25: from /usr/local/share/gems/gems/jekyll-3.8.5/exe/jekyll:15:in `<top (required)>'
    24: from /usr/local/share/gems/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
    23: from /usr/local/share/gems/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
    22: from /usr/local/share/gems/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
    21: from /usr/local/share/gems/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
    20: from /usr/local/share/gems/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
    19: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
    18: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/commands/build.rb:36:in `process'
    17: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/commands/build.rb:65:in `build'
    16: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/command.rb:28:in `process_site'
    15: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:73:in `process'
    14: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:208:in `write'
    13: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:330:in `each_site_file'
    12: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:330:in `each'
    11: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:331:in `block in each_site_file'
    10: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:331:in `each'
     9: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:332:in `block (2 levels) in each_site_file'
     8: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:209:in `block in write'
     7: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/convertible.rb:226:in `write'
     6: from /usr/share/ruby/fileutils.rb:193:in `mkdir_p'
     5: from /usr/share/ruby/fileutils.rb:193:in `each'
     4: from /usr/share/ruby/fileutils.rb:208:in `block in mkdir_p'
     3: from /usr/share/ruby/fileutils.rb:208:in `reverse_each'
     2: from /usr/share/ruby/fileutils.rb:210:in `block (2 levels) in mkdir_p'
     1: from /usr/share/ruby/fileutils.rb:232:in `fu_mkdir'
/usr/share/ruby/fileutils.rb:232:in `mkdir': File exists @ dir_s_mkdir - /media/data/projects/test/_site/freebies/index.html (Errno::EEXIST)
ashmaroli commented 5 years ago

Okay, can you check if the error is reproducible with v2.0.0 of this plugin..? I don't see a trace pointing to jekyll-paginate-v2..

baszczewski commented 5 years ago

@ashmaroli That's right. The problem is probably inside v2.1.0. Downgrade resolve this issue.

thomasvaeth commented 5 years ago
Pagination: Complete, processed 6 pagination page(s)
jekyll 3.8.5 | Error:  File exists @ dir_s_mkdir - /Users/thomasvaeth/barber-jekyll/_site/tag/squid/index.html

Just wanted to say that I got the same error. Pagination was set at 6 posts per page, but I had 12 posts. Downgrading to v2.0.0 worked for me.

HorlogeSkynet commented 5 years ago

Same problem over here, downgrading to v2.0.0 is the current workaround o/

EDIT : Incredible plugin, mostly the autopage feature. Thanks :bowing_man: :wave:

rebeccathedev commented 4 years ago

I just pulled @ashmaroli's PR as a patch into a branch off master and can confirm that it fixes this issue.

I am running Jekyll 4 (and thus master since I need e3cc120b739dcadda87dd732e25c69622472514c from 10 days ago), so downgrading isn't an option.

sverrirs commented 4 years ago

Could you please upgrade to https://rubygems.org/gems/jekyll-paginate-v2/versions/3.0.0 and test again for me?

HorlogeSkynet commented 4 years ago

Works like a charm for me, thanks @sverrirs 👌 💯

minhtran1309 commented 1 year ago

The problem seems to happened again with the error message: mkdir': File exists @ dir_s_mkdir

jekyll-3.9.2 and ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux-musl]