Experimenting with Decap CMS

In my last little post I mentioned that I need to get a content management system (CMS) set up for this site to help me write more frequently. The site is (at the time of writing) static HTML generated from Markdown files by Eleventy (11ty). While Markdown is easy to write in any text editor, I still need to manage image files and their code snippets for Eleventy. Publishing is done through pushing to a Git repository—this part at least handles the build process now. It's not too complex, but I've found it to be a barrier to writing.

The tech stack is good, so I don't want to use a full-blown CMS like Wordpress. I toyed with building my own basic system, but that would require changing the infrastructure I run on (namely, static HTML files on a static file server with no dynamic language such as PHP powering it). Enter Decap.

Decap is a front-end only, JavaScript-powered, Git-backed CMS that was originally developed by Netlify. It runs from an HTML page that pulls in its JavaScript file. This then loads a YAML configuration file. The configuration defines the Git repository it works with, the fields for the blog posts (collections) and individual pages.

So now I have a simple web-based CMS that gives me a interface for writing and handling all the meta data of a post. It's mostly good, but I'm still working out some kinks:

It took a bit of digging around to get images to work. Since I use a shortcode in 11ty to render the picture element I needed to be able to parse that, but still see the image in the live preview while I write.

The default live preview doesn't give options for what meta data is shown or where. I opened a discussion about this on the Decap repository and was told a custom preview renderer was the way to go. That's fine, but I don't really want to build out a custom React component just to move a few fields around in the preview and hide some others.

Another problem is that there is no auto-save or draft. I created a draft field in configuration to keep those blog posts from displaying on the live site, but since they are still files that are committed to Git, the build workflow is still triggered. And if the authorisation session with my Git provider expires, I won't be able to save the text I'm writing and am at risk of losing it. There are features in Decap to work with drafts using pull requests or other branches, but they don't support Forgejo, which is my Git repository software.

Lastly, the UI has not been built responsively with an eye for editing on small screens. This is a really unfortunate lacking feature. It's something I'd like to help the team at Decap with, but I'm a bit loathe to get my hands dirty with React! 😅

Overall, I'm glad to have something to hopefully help me write more. Time and more publishing will tell if the issues above are deal breakers or if I can be bothered fixing them. The nice thing is, it doesn't have any impact on how my data is stored so I can rip it all out with no issues or just stop using it and go back to editing Markdown files directly!