timwis / jkan

A lightweight, backend-free open data portal, powered by Jekyll
https://jkan.io
MIT License
219 stars 309 forks source link

Reduce duplication between Netlify CMS config and schema files #205

Open timwis opened 1 year ago

timwis commented 1 year ago

We already have schemas defined (for datasets, resources, and categories) in _data/schemas/default.yml. See #60 for background.

Configuring Netlify CMS results in quite a lot of duplication here (e.g. Netlify CMS' config.yml vs our existing schema file). That's probably okay for an MVP, but ideally we'd consolidate them, to avoid them getting out of sync.

One thought I had was to have Jekyll run Netlify CMS' config.yml file through its template engine (by adding double --- at the top). This would allow us to effectively generate the collection configuration. But there are some Netlify CMS specific fields that we'd then have to move into the existing schema file. (As an aside, there's also the issue that Netlify CMS uses {{squiggly brackets}} for certain fields like summary). Haven't thought about it much more beyond that yet, but would love to hear thoughts.

timwis commented 1 year ago

I've started adding some Jekyll variables to the config via JavaScript in index.html. That might help a bit, but probably doesn't resolve the problem described above.