avillafiorita / jekyll-datapage_gen

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

How to parse 3 level objects? #44

Closed PierBover closed 6 years ago

PierBover commented 6 years ago

The example shows how to parse a data file and a property in the items. For example a list of books.

What if I want to have a list of book categories, with each category having a list of books, and generate pages for each book with the following folder structure?

category-id/book-id/index.html

avillafiorita commented 6 years ago

this is not possible at the moment.

what you are proposing impacts on the code to generate filenames (line 43 and 44), which is not difficult in itself: a more complex issue is how to represent the filename generation strategy in the configuration file and, more important, how to pass to the plugin the information needed to generate the filenames.

an alternative strategy to solve your problem could be that of generating index pages listing (and linking the books). That is, you could even try to use the plugin on the same YAML structure twice: the first time to generate one page per category (each page listing all the books in the category) and the second time to generate one page per book.

PierBover commented 6 years ago

Thanks for the suggestion @avillafiorita .