Creating a managed website with CouchCMS

20th May 2016 - Web , DevLog

After having decided that I wanted to create this DevLog I had to decide how I wanted to create it. Initially I was set on creating my own content management system (or CMS for short) since I've never been too fond of the ones I've used in the past. I feel that most CMS' fall into one of two categories, either they are too restrictive in order to be as simple as possible, or they are too cumbersome as they try to give the ability to create everything. Managing a site with 50 different plug-ins and hundreds of various small parts to control everything through a GUI is not my description of a fun time. It's no better being stuck with the other half and left wanting for that one single feature that you just can't seem to be able to add.

In my research however I stumbled upon a CMS I had never heard of before, CouchCMS. It is described by the creators as a "simple open-source CMS for designers", and even though I'm not a designer it piqued my interest. The way couch works is by letting you create a template using the regular web technologies HTML/CSS/JavaScript, when you have a template you like (or one you've found somewhere online), you can start adding special tags. CouchCMS is written in PHP and the way to integrate with a template is by using a few simple tags to define what parts of the site should contain what content. An example would be this page where the posts are defined like this:

<cms:template title='DevLog' clonable='1' type='richtext'>
<cms:pages masterpage="index.php" paginate='1' limit='5'>
        <div class="post">
        <h1><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></h1>
        <h3><cms:date k_page_date format='jS F Y' /></h3>
        <cms:excerptHTML count='75' ignore='img'><cms:show post_body /></cms:excerptHTML>
        <p class="readmore"><a href="<cms:show k_page_link/>">Read entire entry</a></p>
    <cms:if k_paginated_bottom>
        <div class="post">
        <div class="readmore" style="text-align:left;">
            <cms:if k_paginate_link_prev>
                <a href="<cms:show k_paginate_link_prev/>">Newer entries</a>
        <div class="readmore" style="text-align:right;margin-top:-20px">
            <cms:if k_paginate_link_next>
                <a href="<cms:show k_paginate_link_next/>">Earlier entries</a>

The first cms:template tag is located at the top of the page and tells Couch that the title of these elements are DevLog of type richtext and clonable (which means that there are more than one entry, the sidebar is an example of content which is not clonable). After that the cms:pages tag tells the index.php page to show at most five entries in a paginated fashion. The rest is a modified version of the template I created where I replaced the static titles, content, links etc. with tags pointing to managed content. The last portion simply tells Couch how to show the pagination buttons. As you can imagine this is not too far from the original template code. In fact there are just about 20 tags added to my initial design for this page to work.

When the tags are added the rest is pretty straight forward. Open couch and it will automatically look through your pages and create the relevant database tables (it relies on MySQL), then it will show the relevant sections in it's user interface and allow you to start creating content using an integrated richtext editor complete with all the features you would expect. The content will then be automatically fetched whenever you load a web-page completing the Couch integration.

Concluding remarks

All in all I would say that CouchCMS is a pretty solid solution. It might not always be trivial to know exactly how to use the tags but their online resources and forums are very helpful. If you are comfortable with designing and maintaining your sites design and functionality through HTML/CSS/JavaScript then I can definitely recommend CouchCMS as a tool to manage the content of your site. It gets your of your way when you want to do web design related stuff but steps in with all the neccesarry tools when you need them. There is one drawback however, it is dual licenced. With the free open source licence (CPAL 1.0 at the time of writing), you can use it for commercial purposes and modify the source but you must include attribution in the source (if you change it) and also attribution in form of a hyperlink in the front-end site. With the commercial licence you are allowed to remove the attribution on the site  and replace the CouchCMS logo and copyright information from the back-end interface. This would basically allow you to set up a business around creating sites powered by CouchCMS where your customers would never even know that you are using the software, even with access to the back-end content management system. The price for the purchased licence is at the time of writing $39 as a one time fee per domain.