dreikanter / public-static

Programmer's approach to web content management
https://github.com/dreikanter/public-static
BSD 3-Clause "New" or "Revised" License
11 stars 1 forks source link

public-static

This is a static website builder with the following features:

Installation

The latest stable version could be installed from PyPI:

pip install publicstatic

Use this command to install latest development version directly from GitHub:

pip install -e git+git://github.com/dreikanter/public-static#egg=public-static

Default website configuration uses Yahoo's yuicompressor for CSS and JavaScript minification. To use this tool Java runtime should be preinstalled.

Basic usage

The following command creates a new website source in the current directory:

pub init

Use the following commands to add posts or pages:

pub post "Good news everyone!"
pub page "True story"

With default configuration this commands will create a new post supposed to be located at http://example.com/posts/good-news-everyone, and a page http://example.com/true-story.

After adding some content the website should be built.

pub build

This command will generate HTML pages using text content and template files. Build output will also include CSS files and any other assets included to the website source. Generated website could be previewed right on the local host:

pub run -b

-b option tells public-static to open site root page using the default browser.

The last operation is to deploy generated web content to the destination server:

pub deploy

This command suppose to use external tool like rsync or aws to synchronize local web content directory to the remote one. The actual command should be predefined in the configuration file as deploy_cmd parameter value. See some examples on wiki.

Use --help for detailed command line arguments description.

Page file format

Each page is a plain text/markdown file complemented with the optional metadata in the header. The format is pretty straightforward. Here is an example:

title: Hello World!
updated: 2012-06-05 13:49:38
template: default
custom-field: Custom field value

# Hello world!

This is the main page contents section.

Some details:

Configuration

Public-static configuration resides in a yaml-formatted file pub.conf in the root of each website directory. init comand generates this file with default parameter values and a brief comment for each of them. Configuration supposed to be updated after site creation to fit user requirements like site structure, deployment destination, etc.

Content migration

There is a great tool to export Wordpress data to public-static-compatible files: wp2md.

Troubleshooting

Licensing

Copyright © 2013 by Alex Musayev. License: MIT.