Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Netlify CMS as the editing UI #203

Merged
merged 12 commits into from
Jan 13, 2023
Merged

Use Netlify CMS as the editing UI #203

merged 12 commits into from
Jan 13, 2023

Conversation

timwis
Copy link
Owner

@timwis timwis commented Nov 15, 2022

Following on from #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:

  • It's open source
  • It doesn't require you run it on Netlify (or GitHub, for that matter)
  • It requires minimal changes to JKAN (just a drop-in compiled JavaScript file, via CDN or vendoring)
  • It's very customisable
  • It even supports open authoring, which would let any end-user of JKAN propose a change via pull request through the UI (something @BryanQuigley proposed which I think would be awesome)

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:

  • Add the rest of the fields
  • Review and decide on the backend and authentication options
  • Try to reduce duplication between the netlify cms config schema and the schema we already have in _data/schemas/default.yml
  • Add more accurate preview templates
  • Support editing site settings, as in the existing JKAN admin (site config), if possible
  • Support editing categories and licenses
  • Replace the existing JKAN editing UI with links to this, and make it clear to contributors that they're welcome too

Thoughts?

@BryanQuigley
Copy link
Collaborator

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
Copy link
Owner Author

timwis commented Nov 16, 2022

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.

@timwis timwis added this to the Netlify CMS milestone Nov 16, 2022
This was necessary to support editing in Netlify CMS. See #207.
I've added a line in index.html that should provide backwards compatibility. Note that this commit breaks editing. This could be fixed as well, but since it's being removed as part of the Netlify CMS milestone, I haven't included it here.
license, category, maintainer, maintainer_email
@BryanQuigley
Copy link
Collaborator

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 timwis changed the base branch from gh-pages to v2 January 13, 2023 13:16
@timwis
Copy link
Owner Author

timwis commented Jan 13, 2023

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?

@timwis timwis marked this pull request as ready for review January 13, 2023 13:40
@timwis timwis merged commit 0898332 into v2 Jan 13, 2023
@timwis timwis deleted the netlify-cms branch January 13, 2023 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants