avillafiorita / jekyll-datapage_gen

Generate one page per yaml record in Jekyll sites.
369 stars 80 forks source link

Message "Configuration file: [...]/_config.yml" repeated over and over in console #50

Closed AxelTerizaki closed 4 years ago

AxelTerizaki commented 5 years ago

When generating a website using this plugin, my console gets flooded with this message (I removed the full path from it)

I'm not too sure what triggers it, wether it's the collection itself, or if it's the datapage_url liquid filter provided by the plugin (BTW I discovered it by chance, it's not in the docs IIRC). I use the filter a lot due to how it allows me to link generated pages from other pages.

You can take a look at the jekyll site in question if you want to try it out : https://lab.shelter.moe/karaokemugen/sites/mugen-site

This is not a particularly big bug but it's kind of annoying :)

avillafiorita commented 5 years ago

Hi there, could you send me your configuration file, to understand where the problem is?

avillafiorita commented 5 years ago

Never mind, I observed the behavior when trying to reproduce issue 54. "Upgrading" it to bug

kencoenen commented 5 years ago

This can be fixed by changing Jekyll.configuration({})['page_gen-dirs'] into @context.registers[:site].config['page_gen-dirs'].

jeremydouglass commented 5 years ago

I'm also seeing this problem in Jekyll 3.5.2. (actually, looks like in my case the same error msg is coming from a different plugin.)

I'm guessing the fix that @kencoenen suggests would go here?

https://github.com/avillafiorita/jekyll-datapage_gen/blob/e4351d5710c97fb99a0362ce2e9a4e5b2ad12fe0/data_page_generator.rb#L128

dannguyen commented 4 years ago

Just wanted to say big thanks to @kencoenen for creating and naming this issue so that it was easy to find a year later :)

The code substitution works just as ken and @jeremydouglass say, within the definition of datapage_url() in data_page_generator.rb

    def datapage_url(input, dir)
# OLD    extension = Jekyll.configuration({})['page_gen-dirs'] ? '/' : '.html'
# NEW   change via: https://github.com/avillafiorita/jekyll-datapage_gen/issues/50#issuecomment-523383573
      extension = @context.registers[:site].config['page_gen-dirs'] ? '/' : '.html'
      "#{dir}/#{sanitize_filename(input)}#{extension}"
    end
  end
avillafiorita commented 4 years ago

I have finally introduced the changed suggested by @kencoenen.

49 chars changed in 240 days: this estimates my productivity at 4 days per char... it does not include the time to delete the old line, though ;-)

Thanks to everyone for their patience and to @kencoenen for providing the solution!