carpentries / feeds.carpentries.org

A repo to generate dynamic JSON data feeds for The Carpentries
https://feeds.carpentries.org
MIT License
3 stars 2 forks source link

Re-organize outputs #40

Closed fmichonneau closed 2 years ago

fmichonneau commented 4 years ago

to keep the file structure clean, the output should all be generated outside the root of the repo:

Need to adjust the scripts (make sure the files get written to _data) and the Makefile accordingly (make sure _site gets created early enough to hold the artifacts).

maneesha commented 4 years ago

When does _site currently get created?

fmichonneau commented 4 years ago

we currently rely on Jekyll to generate the GeoJSON files. The _site directory gets created last in the Makefile.

maneesha commented 4 years ago

Right, but you can't cp to _site unless _site already exists, right? So I was thinking it initially got created somewhere else. I tried adding mkdir _site earlier on but that didn't work.

maneesha commented 4 years ago

Also why would it not work to send everything to _data? Why do plots need to get sent to _site?

fmichonneau commented 4 years ago

By sending everything to the _site folder the files are directly available at the root URL (e.g., plot_instructor_teaching_frequency.svg will become available at https://feeds.carpentries.org/plot_instructor_teaching_frequencyd.svg). Keeping this flat structure makes things easier to manage.

Additionally, Jekyll doesn't make the files in _data available (in other words, the _data folder isn't included in the _site folder generated by the jekyll build command). That's why the JSON files that are generated in the _data folder get copied in _site. They need to be in the _data folder because that's where Jekyll expects them and we use them to create the GeoJSON files.

but you can't cp to _site unless _site already exists, right?

Yes, you are right. That's why the Makefile will need to be reorganized to ensure that the _site folder exists early enough to hold these files.