avillafiorita / jekyll-datapage_gen

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

If template is found: Error: undefined method `split' for nil:NilClass #49

Closed Sakrecoer closed 5 years ago

Sakrecoer commented 6 years ago

First of all, thank you for writing this plugin, I've been looking high and low for something like this.

However i fail to put it to proper use.

With jekyll 3.8.3 if i enter a valid layout name in _config.yml, jekyll gives me the aforementioned error and exits.

If i enter a bogus layout name, jekyll will complain about a missing template but run successfully, although obviously no pages are generated.

Content of _config.yml:

page_gen:
  - data: releases
    template: album
    name: releases.title
    dir: records

Content of layout in _layouts/album.html

{{ page.title }}

Content of _data/releases.yml

- 
  archive: "https://archive.org/details/BPIST013"
  artist: tfb
  coverart: 
    art: "TFB-OTK.png"
    thumb: "TFB-OTK.png"
  description: "Enter this cybernetic opus of oblivion and computer aided overstanding, grown somewhere beyond the laws of physics.<br />From earth to your folder, we send you vibrant energy, defying the relative time of life. We wanted to hand you the key to inner-space and Invite you to Enter:<br />THE FRAGLEBAY<br />ON THE KEYBOARD<br />ON THE KEYBOARD<br />on the keyboard<br />on the keyb<br /><br />Stay Fragle!"
  title: "TFB - OTK"
- 
  archive: "https://archive.org/details/BPIST011"
  artist: franky
  coverart: 
    art: "DustAndSoda.jpg"
    thumb: "DustAndSoda.jpg"
  description: "Dust And Soda is radical disco by young Mexican producer, Franky Fresco."
  title: "Dust And Soda"

Pretty sure it's me doing something wrong, but i've run out of ways to find it out by myself. Hopefully someone can point me in a good direction.

Thanks for your time, *Set

AxelTerizaki commented 5 years ago

Not sure if this is related, but I've had this error because the data inputted in the plugin was not what it was waiting for.

What it's reading is neither an integer or string, but it tries to apply the tr function to replace characters, and it won't work on something other than a string.

Kind of clumsy but I've never used Ruby before. I edited lines 11-13 of the ruby file to make it look like this :

if(name.is_a? Integer)
          return name.to_s
        elsif (!name.is_a? String) && (!name.is_a? Integer)
            return name.to_s
        end

And it fixed my issue.

Basically if the value is neither string or integer, it won't try to convert it (it tries to remove the diacritics)

Hope this helps. I've also been trying to use pagemaster, maybe that's going to work better for you. It basically does the same thing : https://github.com/mnyrop/pagemaster

Sakrecoer commented 5 years ago

Thanks you very much for your feedback @AxelTerizaki

I'll give your fix and pagemaster a try, but it'll take me some time because it will have be for another project.

For my current purpose, my good friend @aengl went ahead and wrote a custom solution to my problem: https://github.com/aengl/publikator

Friendly regards, Set

avillafiorita commented 5 years ago

Hi, no need for the releases. part in the field name (file config.yml). This configuration should work with your data:

page_gen:
  - data: releases
    template: album
    name: title
    dir: records

Let me know if it works, so that I can close the issue! Thanks!

Sakrecoer commented 5 years ago

Thank you @avillafiorita I will try later this week and get back to you!