Carbon

Hackable performant semi-static blogging system


Project maintained by svandragt Hosted on GitHub Pages — Theme by mattgraham

Carbon

Carbon is a hackable performant (semi) static blogging system.

It should be considered early alpha.

A screenshot of the default theme: Screenshot of the defaul theme

Screencasts

  1. Installing Carbon in developer mode on a shared host
  2. Enable caching for production use
  3. Generate a static site

Aims

Installation

Carbon requires PHP 5.3+ and is tested on IIS 6.1 / Windows & Apache / Ubuntu.

  1. Check out this repository and point your webserver to the public folder.
  2. Open public/Configuration.php and override any constants from public/system/Defaults.php.
  3. Open the site in your browser. A cache and logs folder outside public will be created, and example content loaded from public/content.

Concepts

Posts are listed in the index page. Pages contain a section of YAML followed by Markdown, by default.
Pages just contain markdown content, by default. In the basic theme, pages are linked from the footer.
Configuration settings override the defaults.
Manage your data models and theming logic using the MVC classes in the public/application folder.

Request object:

Controllers:

Model types:

View types:

Basic configuration options

open public/Configuration.php to:

Getting started

Turn off Pretty Urls

By default Carbon uses Apache's mod_rewrite and IIS'es URL rewrite to keep urls nice. You can disable this behaviour by opening public/Configuration.php: set const INDEX_PAGE = '/index.php';. This adds /index.php to all urls (eg: /index.php/admin/new instead of /admin/new);

Caching

To enable caching: open public/Configuration.php and set const CACHE_ENABLED = true;. Pages remain cached until its cache-file is deleted, manually or through Admin > Clear Cache. Caching is required if you want to generate a static site.

Full static site generation

Navigate to Admin > Generate static site. The cache folder now contains a full static site.

To deploy the static site, open a Powershell and run .\carbon.ps1 deploy. The script will ask for a keyword (for example: live), after which you can redeploy quickly by recalling the settings: in this case using .\carbon.ps1 deploy live. Currently the script only supports sftp connections. It requires WinSCP and the WinSCP .NET Assembly / COM library.

Externals

Carbon will support third-party plugins (externals). Simply drop a spl_autoload_register compatible class into the system/Ext folder and call the class in the code. See the php manual page for more info on autoloading classes. Feel free to organise classes using custom folders.

Carbon will register any externals and autoload them. It comes with markdown and yaml support courtesy of PHP Markdown Extra and Spyc.