3 ms·
This looks like it’s based around the “page” paradigm, which is fine for some sites, but for many types of sites I’ve found that you often want to manage entiti
by tomduncalf 7y ago
This looks like it’s based around the “page” paradigm, which is fine for some sites, but for many types of sites I’ve found that you often want to manage entities with a set of custom fields instead of full pages, then compose the pages from combinations of these entities.
I’ve been pretty pleased with Cockpit CMS (getcockpit.com) for these kinds of sites. It’s a headless CMS similar to something like Prismic or Contentful, but it’s self-hosted and open source. It uses PHP and SQLite (which means it’s easy to host wherever) and the code is fairly easy to understand if you do want to make changes.
The way I’ve been working with it is using Cockpit to manage the content, which is then consumed by a React site via Cockpit’s API. In order to decouple the CMS and the actual site (and to provide security, versioning and fast page loads), I use react-static (also highly recommended!) to create a static HTML/JS site - so the workflow is: edit content in Cockpit, then trigger a build (I use Netlify for this) which generates a static version of the site which you can then preview and publish easily - it’s just HTML and JS files.
You could use e.g. Drupal or Wordpress to do this with the right plugins, but I’ve found the level of complexity there (both from a developer point of view, and for end users especially in the case of Drupal) too high for simple freelance projects. Cockpit strikes a good balance of flexible yet easy to understand and customise for me - I did also investigate some options such as Netlify CMS, but at the time it didn't seem flexible enough to meet my requirements, this may have changed!
- lucasverra 7y agohi there, thanks for sharing. How is the workflow for a preview feature ? Meaning, i'm editing content, i kinda want to see what it will look like IF published. Should i wait for an entire build of (assume 30 to 100) pages just to see this new/updated one ?
- tomduncalf 7y agoAh, yes unfortunately you do need to wait for a build in the way it’s currently set up. The largest site I’ve done is probably in the 50-100 page region and that does take 2-3 mins to preview. One option might be to run react-static in dev server mode on a server to generate the preview, this will generate the site on the fly rather than in advance (as it’s intended for development use with hot reloading etc) - I’m thinking of trying this on my current project.
- lucasverra 7y agocontentfull and gatsby are kinda tacking this exact preview issue. But telling a non tech editor to wait for several minute for a preview is a big NONO from my side. Sadly contentful is not free in a nice free tier (0): https://www.contentful.com/blog/2019/04/24/content-preview-for-your-contentful-gatsby-site-with-nextjs/ https://www.contentful.com/blog/2019/04/24/content-preview-f...
- tomduncalf 7y agoYeah, it does depend on your requirements of course, the sites I’ve used it for are freelance sites for small companies for whom waiting a minute or two isn’t a big problem. Should also note that I don’t think Cockpit has versioning or draft states so probably not suitable for a “big” site with lots of editors etc. Like I say, the dev server route may be a way to make this more dynamic. Another possibility is that it seems like react-static can now do incremental builds for only a subset of routes, so you could just republish a given route I’d it’s easy to map from CMS entity to affected route(s). One other thing to keep in mind is that for some categories of site, moving away from the “managing pages” CMS model to the “managing content models” often makes the site much easier to manage (e.g. you can’t break the layout by editing the wrong thing in a wysiwyg editor) so there may be less need for frequent previewing. But I agree, not a solved problem yet. Running the preview on the dev server is the best I can think of for now. You can imagine some kind of site-aware CMS that understood how entities mapped to components and could show inline previews in a React Storybook kind of style, that could be neat!
- tomduncalf 7y agoFor the record, I did go with the route of running react-static in dev mode on the server for preview (using Phusion Passenger to run it, as this was set up on the server, which required an app.js file to start the server: https://gist.github.com/tomduncalf/00070fecb68a6cf35c0102c75f166a8a https://gist.github.com/tomduncalf/00070fecb68a6cf35c0102c75...). Seems to work really well. I've got another simple server at "/restart" running which touches "tmp/restart.txt" when hit which forces Phusion Passenger to restart the dev server, which forces it load the content again. Takes like 10-15 seconds to be ready to preview, client is very happy compared to the old setup which required a few mins of building to preview!
- justanotherc 7y ago> you often want to manage entities with a set of custom fields Perch Runway (the big boy version of Perch CMS) can handle exactly that, although I've never personally needed it, I usually just stick with regular Perch because I'm more familiar with it and you can kind of shoe-horn some collection-like behavior into the page paradigm well enough. Personally I enjoy Perch, but I'm also lately getting really into WP with ACF.