3 ms·
hi 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.
by lucasverra 7y ago
hi 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!
- tomduncalf 7y agoAnd yes, Contentful pricing is not suitable for small businesses IMO. Ramps up too quickly. It’s a pretty good CMS but for my freelance needs, Cockpit is fine.