grimmdude/jebson

A content management system based on static files aimed at ease of use and swift load times.

dev-master 2023-02-16 19:07 UTC

This package is not auto-updated.

Last update: 2024-10-08 03:20:34 UTC


README

Up until now I've always used Wordpress to manage my website; mainly because it's easy to use and it's what I learned on. It's great in that regard but lately I've been realizing how slow it is. I realized that I didn't even need the media library, special SEO plugins, dynamic nav menus, and widgets. Then I realized, I don't even need a database. I wanted a system that was fast to load, and simple to add content or modify template files. Basically I wanted a static site, but I wasn't too keen on learning a bunch of new terminal commands and re-building every time I write a new post.

Blah blah blah, so I wrote my own CMS. While it still technically builds each page dynamically it's quick loading, and there's no database to fuss with. I call it Jebson, named after one of my pups. Jebson is a very lightweight databaseless CMS that is geared towards simplicity and swift load times. Note that currently I'm writing this is so I will have some documentation for myself so it may not be complete. You'll notice I borrow some stuff from popular static site generators, that's just how I roll.

Setup

Jebson is written in PHP and is setup to use Apache. To install place all of Jebson's files into your webroot. Now say "yea I did it!".

Directory Structure

.
   .htaccess
   assets/
   cache/
   content/
      2013-08-22-sample-post.php
      sample-page.php
   config.php
   index.php
   lib/
   views/
      404.php
      body.php
      excerpt.php
      footer.php
      header.php
      post.php

All of the settings for Jebson can be found in the Config class (config.php).

Views

These are the common files that get loaded on each page like the header, footer, etc... All views are .php files and live in the /views directory. Below are the variables that you'll need to echo in your view to output content and other available data.

View Variables

To define the load order for the views use the config array Config::$viewLoadOrder

View Methods

Writing Content

All content is saved as .php files in the /content directory and markup is standard HTML. Naming conventions are as follows:

Posts

For posts which are to be sorted by date:

2013-08-22-url-of-the-post.php

This will result in a post url like so:

website.com/2013/08/22/url-of-the-post

Pages

For pages, that is content not considered a dated post, just leave out the date:

title-of-my-page.php

Which results in this url:

website.com/title-of-my-page

Each file starts off with some basic properties to define stuff:


<?php
self::$pageData['title'] = 'Title of the post or page.';
self::$pageData['keywords'] = 'Comma separated keywords.';
self::$pageData['description'] = 'Description';
?>

These variables are available in the views and can be used how you wish. Obviously I'd use these basic definitions for page meta data, but you can also add your own custom definitions to trigger things like comments, layouts, scripts, css, etc.