getzola / zola

A fast static site generator in a single binary with everything built-in. https://www.getzola.org
https://www.getzola.org
MIT License
13.12k stars 924 forks source link

Using datasets in templates #826

Closed fbnlsr closed 4 years ago

fbnlsr commented 4 years ago

It would be nice to be able to use datasets (from yml, TOML or json files for instance) inside templates in Zola.

Jekyll uses Data Files, Hugo uses the Data Folder. Zola should have something similar.

Keats commented 4 years ago

Is https://www.getzola.org/documentation/templates/overview/#load-data not enough?

fbnlsr commented 4 years ago

That might be what I'm looking for indeed. 🤔

Is there a way to use multiple data sources? More precisely, is it possible to browse several folders? In my particular case, I'm using a collection of multiple yml files spread across several folders and I need to loop through them to get the data I need.

Keats commented 4 years ago

You can just use set to store all the data loaded in a variable as many times as you want, they just need to be in the content directory.

fbnlsr commented 4 years ago

I get that, but is Zola able to discover and loop through several folders? I have a bunch of auto-generated folders that I scrape to build the comment section of my blog. The structure looks like this: https://github.com/fbnlsr/primative.net/tree/master/data/comments

Keats commented 4 years ago

Ah if they are auto-generated then it's not going to be possible :/

epsilonhalbe commented 10 months ago

this is a feature that I'd be interested as well, I'd be willing to implement it if there's no objections.