timwis / jkan

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

Use Netlify CMS as the editing UI #203

Closed timwis closed 1 year ago

timwis commented 1 year ago

Following on from https://github.com/timwis/jkan/discussions/198

I've been really impressed with Netlify CMS. It worked out of the box with JKAN. You just add a configuration file, where you define the schema of your collections, and it generates a nice looking editing user interface.

Screenshot 2022-11-15 at 07 12 36

It also ticks a lot of boxes for us:

The only downside I can think of is that it's a single page app, so it requires JavaScript to run.

This pull request is just a demo. It's currently configured to run locally using the local backend feature. To try it out:

  1. Clone this branch (netlify-cms)
  2. From the local JKAN directory, run npx netlify-cms-proxy-server (requires Node.js)
  3. Run JKAN with bundle exec jekyll serve
  4. Navigate to localhost:4000/manage/

You should then be able to save changes to your local files, rather than to the repository on GitHub. When it's running in production we would remove the local_backend config option, and you would authenticate via GitHub.

If we agree this is the way forward, some of the remaining steps, I'd imagine, would be:

Thoughts?

BryanQuigley commented 1 year ago

That looks/works awesome!

For running Jekyll locally from docker compose I had to add: local_backend: allowed_hosts: ['0.0.0.0']

I like the idea of supporting using netlify-cms locally in addition to potentially adding the github backend.

timwis commented 1 year ago

Okay, I'll break this out into issues to track the work. I managed to get site settings added to the editor UI this morning, which was surprisingly easy.

BryanQuigley commented 1 year ago

Let's get a version that just works locally for now, and keep Netlify bits for a future enhancement.

Getting some version of this and #213 committed makes further work much easier.

We are hoping to make our fork for OpenDataPhilly some time in the next couple weeks - and want to finish these (and other) big changes first.

timwis commented 1 year ago

Okay, I've created a v2 branch so we can start merging these without updating the JKAN website, docs etc. Hopefully it won't be long before we can 'release' v2 (merge it into gh-pages), but (a) we'll want to make sure we have release notes, updated docs, and it's easy for new users to spin up a new JKAN instance, and (b) you don't need all that to kick off your fork. So hopefully you can fork off the v2 branch for the time being? Let me know if that works for you.

P.S. Where are you planning to host OpenDataPhilly? Are you up for using Netlify?