RichTree CMS

RichTree CMS

RichTree isn't quite a CMS, it's more of a content delivery system. It was designed for system administrators, who have direct access to their web server, and want to provide content in the form of articles, image galleries, and files, displayed in a hierarchical manner. That is to say, you create directories and dump the content in those directories.

Because of its simple design, no database is required (i.e. it doesn't use one). There's also very limited risk for security vulnerabilities, because RichTree has no ability to modify content.

There are other no-database CMSs, but I didn't find any with the design goals of mine.

You can modify RichTree in any way, for any purpose, as long as you credit me.

Overview

Articles are written in the markdown format. Markdown was chosen because of its simplicity, readability of source files, and its strength.

Images in articles, and image galleries, are all automatically thumbnailed and displayed using lightbox. This means, to create an image gallery, you dump images in a directory, and tell that directory that it should be an image gallery.

If you want to display a file listing, you just tell the directory that it should have a file listing.

Note that image galleries and file listings also count as articles -- you can include content description if you desire.

RichTree automatically provides navigation to the current article's children, on every page, by checking for articles and directories in the current directory. If the current article isn't a directory, that means it has no children. RichTree also automatically provides a main menu, by displaying the root directory and all of its children. When you're in the root directory, it doesn't show its children in the navbar, because that would be ugly and redundant. Conceptually, from a user's standpoint, that means the home page doesn't have children.

There are a couple other nice features RichTree provides. You can include a disqus comment section on any page, as long as you have a correctly-configured disqus account. There's also a sitewide search option, which simply performs a google search, for only your site. This is the best option in the absence of a database, and google is pretty good at indexing sites.

How to Install RichTree

Step 1: Download richtree_20150211.zip.
Step 2: Extract in your webserver's document root directory, or another directory.
Step 3: Edit config.php.
Step 4: Modify the content in the content/ directory.

How to Use RichTree

Articles are written in the markdown format. You need a rudimentary understanding of markdown to proceed.

Individual articles are placed in the content/ directory. Articles are named like directory/index.md, or article.md. Every article is a markdown file, which optionally starts with a header.

The header is a comment section at the very beginning of a file. The header looks as follows:

<!--
Option1: value1
Option2: value2
-->

Below are options, and what they do.

Title

Title is the most basic option. Titles are generated automatically, if you don't specify one, based on the file or directory name. Underscores and hyphens are translated into spaces.

Title: Example Title
Description

The description is displayed in the nav bar, when listing articles. It's also used for the article's meta description tag. It doesn't show up on the body of the article itself.

Keep your descriptions short. They should be around 1 or 2 sentences.

Description: This is an example description. It's for demonstrational purposes only.
Hide

The Hide option is used to hide file from a file listing, or directories from a nav listing. It accepts a comma-separated list of files. Note that you need to give the actual file or directory name. So, to hide file.txt, you need to specify file.txt, not file. If you want to hide articles, see the NoIndex option below.

Hide: hidden_directory

Or:

Hide: file2.txt,directory,song.mp3
NoIndex

This option takes only 1 value: true. It does 2 things: it tells spiders not to index this page, and it tells RichTree not to generate any nav information for this page, at least from the public portions of the site. Note that all of its children will be also marked as NoIndex, but nav information for them will be generated from this page. That is, you can navigate from NoIndex pages to other NoIndex pages, but you cannot navigate from public pages to NoIndex pages.

Pages marked with NoIndex will be hidden from the public's eye, but still accessible.

NoIndex: true
Template

This option is used to select the template used to generate the page. If you don't specify one, the default template is default.html. The two which are provided are file-listing.html and image-gallery.html. This is how you show file listings and image galleries. This functionality can be extended for any custom article types you might desire.

Template: file-listing.html

Or:

Template: image-gallery.html
Sort

The Sort option is used to sort article listings in the nav bar. It's also used to sort items in the main menu, because the main menu is simply a nav bar listing for the root directory, prepended with the root article.

The default sort item is date_desc, which shows articles in reverse-chronological order, based on their last-modified time. There's also alpha, which sorts articles alphabetically by their titles, and weight or weight_desc, which sorts articles by weights given in their headers.

Sort: alpha
Weight

The Weight option is used on the children of an article which uses weight sorting. This value is given as a floating-point number, or an integer. Higher weights are listed before lower weights.

Weight: 5

Or:

Weight: 5.5
Comments

The Comments option only has 1 acceptable value: true. If you have disqus configured properly, this will cause a disqus comment section to be added to this article. If not, this is ignored.

Comments: true

Technical Details

RichTree is written in PHP, uses Parsedown to translate markdown to html, and uses twig as a templating engine. The "richtree" class provides a lot of methods for getting data about the current article, but doesn't actually generate any information by itself. An article's information (e.g. the main menu, the current node's children, the body) is all driven by the template, which dynamically pulls the data by using the richtree object's methods. Methods that perform expensive operations (e.g. reading files from a directory) cache their results, so there's little performance penalty for calling a method multiple times.

The thumbnailer is a separate PHP file, which could be used as a standalone if desired.

RichTree uses a modified version of Parsedown -- modified to obfuscate email addresses, and to turn images into thumbnailed, lightboxed images. The lightbox has also been modified, for much faster animations (because the default animation speed annoys me to no end).

TODO

RichTree doesn't currently have any functionality for organizing blog posts/news articles. The issue with news articles, is they normally don't fit into a nice hierarchy, but have several different data representations -- you can view all articles with a given tag, you can view articles by year/month, or you can simply view all articles. This kind of organization is much more suited to a database, which can slice your article listing any way it sees fit. TODO: an article-listing template, which shows news articles in a paged format.

Descriptions on inline images, generated from markdown.

Proper layout of inline images. That is to say, getting the text to float around them, or something. I haven't thought of a good solution to this one yet.

Thorough documentation of source code. This is, of course, an ongoing process.

Putting all configuration variables in the config file. For example, hidden files.

Using a global array for config variables, instead of defines.