avillafiorita / jekyll-datapage_gen

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

Top-level generated index contains mix of two #116

Closed sammyjava closed 2 years ago

sammyjava commented 2 years ago

I seem to have hit a bug, but I'm hoping it's something I'm doing wrong. I've got two templates for which I want to generate pages, with the following in _config.yml:

page_gen:
  - data: taxon_list
    template: taxon
    dir: taxa
    name: genus
    index_files: true
    debug: true
  - data: taxon_list
    template: collection
    dir: collections
    name: genus
    index_files: true
    debug: true

If I comment out one directive, it works fine for the other. However, when I have both directives present as shown above, the top-level collections/index.html inherits code from the taxon template! It has some correct content at the top, but lower down it has code from the taxon template instead of from the collection template.

I have not been able to find a combination that works reliably and, oddly, it's always the collections/index.html that gets malformed while the taxa/index.html is always fine. The generated index files are always fine (e.g. /collections/arachis/index.html), it's just collections/index.html that is a malformed combination of both the taxon and collection templates.

If I don't run the datapage-generator at all, then both /collections/index.html and /taxa/index.html are generated fine (but there are no subdirectories generated, of course.) So it seems like the datapage-generator is interfering with the generation of the index files under _site/taxa and _site/collections from the layouts, while it does a fine job of creating the subdirectory/index pages.

bundle exec jekyll serve --verbose reveals no difference between how taxa and collections is being handled.

I'd appreciate any tips on things to try!

Oh, and here's those files with the layouts specified in their front matter: taxa/index.html:

---
layout: taxon
title: Taxa
tools_menu: true
---

collections/index.html:

---
layout: collection
title: Collections
tools_menu: true
---
sammyjava commented 2 years ago

I'm closing this. Although it might be considered a bug, I found that the problem was fixed if I made the "template" under layouts to be code for only the generated pages, and the top-level page index.html contain the code for the top-level page. Before, I had an if-then clause for both which caused this bug. Which is a pretty obscure scenario, so poof.