RT Cunningham


My Custom CMS Could Be Interesting to at Least a Few Web Developers

custom CMSI designed my custom CMS to use as few resources as possible on a $5.00 droplet at DigitalOcean (yes, that’s a referral link). It’s unique in at least one way, which I’ll explain shortly.

I shared the code for it but I won’t be sharing it anymore. Previously, I shared the code to a WordPress static site generator and a semi-static WordPress website. I won’t be sharing any of that anymore either. I’m in the process of removing related articles and images (if necessary). I will, however, share some concepts in this article today.

You see, far more people care about website content than what creates it and that applies to both content creators and website visitors. Less than two visits to specific URLs over the course of months shows me a complete lack of interest in the technical side of the story. I would have to be a dedicated developer for an established CMS to get any real traction with them.

A Two Part Custom CMS

The custom CMS runs on my laptop computer. Only the results end up on the web server. My laptop computer operating system is Linux Mint, a Debian and Ubuntu derivative. The server operating system is Ubuntu, a Debian derivative only. Both machines use compatible code since I’m using Nginx and PHP on both of them.

This is the software I use for the laptop computer side of things:

This is the software I use for the server side of things:

Yes, other than the Nginx web server and the PHP scripting engine, I only need Syncthing on the server. I will occasionally use the FileZilla FTP client on my laptop computer, but it’s not part of my workflow. I use it to remove posts, associated images (if not being used elsewhere) and cache files from the server.

My Workflow

When I draft a new article, the first thing I do is create the title with the appropriate keywords. Then I hunt down a suitable image. The first place I look is Pixabay, but there are other places I check when I have difficulty finding what I want. Wikimedia Commons is one and Stock Snap is another.

I save the image to my pictures directory and edit it with XnView MP. For me, it works as well as Irfanview on Windows. I then save two images to the CMS images directory, one at 150 pixels wide and the other at 1000 pixels wide (unless the original image is 1024 pixels wide or less). Using the Responsive FileManager plugin with TinyMCE, I link the smaller image to the larger image (when I use a larger image).

The form I use for creating and editing posts contains the post title, a schema block for the post image (whichever I select if there’s more than one), the content area, the meta description, a list of categories to choose from, the date and the time. The form for the static pages doesn’t have categories.

Before I save a post, I copy the images for it to the web server. When I save the post, it’s saved to the same directory locally as it ends up in at the web server. I can edit the post at will until I’m ready to publish it. Publishing it means I have to copy the post to a special directory. After Syncthing copies it to the web server, a cron job-driven PHP script moves it to the posts directory on the web server.

Except for rare circumstances, I share my posts on Facebook and Twitter. I credit image authors as often as I can and I publish my links at their sources when I can.

File Formats

There are two directories concerned with posts at the web server. One is the posts directory and the other is the cache directory. Each post is an ini (“.ini”) file that’s read by the PHP parse_ini_file function. The PHP routines at the web server cause each post to be displayed as web pages while caching them (if the previously cached pages haven’t expired) exactly as they displayed.

I prefer JPG and PNG files for images. I never use PNG files for the larger images because JPG files tend to be smaller than PNG files. The visual differences aren’t noticeable by most human beings.

Alternatives to a Custom CMS

The heavy lifter, the one size fits all software is WordPress. You can choose to host your website at their commercial service or you can host their software on your own web server. I self-hosted WordPress for many years.

I like BatFlat because it’s a lightweight CMS that uses SQLite instead of MySQL as it’s database component. That means it uses a lot less memory to do most of the things I would need it to do. If I didn’t create my custom CMS, I probably would have switched to BatFlat.

There are hundreds of CMS platforms available. There isn’t any way I could possibly go over all of them. You can find a list of content management systems at Wikipedia and even that’s incomplete.

Image attribution: The original Nginx logo is in the public domain. The original PHP logo is by Colin Viebrock (Download Logos and Icons) [CC BY-SA 4.0], via Wikimedia Commons. The combined image is by RT Cunningham, with the same Creative Commons license.

Share: Facebook | Twitter

By RT Cunningham
January 8, 2020
Web Development