shsite: bash site builder

April 19, 2011 at 02:57
filed under   |   no comments (Leave a comment)

Share on RedditShare on FacebookShare on Google+Tweet about this on TwitterShare on StumbleUponPrint this page



shsite will build for you a complete, static site, based on a template. The content you provide is in simple txt or html format.

Who is it for

Maybe people who don't want or can't use CMSs, PHP/ASP/whatever.


To run shsite you need:


shsite <template> <outputdir> <inputdir> [-m file] [-u file]
     -m Use this file as a map.
          Default is <inputdir>map.
     -u Only update this file.


To update page1.html, simply run:

$ shsite template /home/user/public_html/ ./content/ -u page1


The template is an html file. It is "applied" to each file of content, replacing __keyword__ with appropriate data for the keyword, taken from the map and content.
For example:

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html lang='el'>
        <meta name='Keywords' content='__meta__' />
        <link rel='stylesheet' title='Basic style' type='text/css' href='./style/index.css' />

    <div id='container'>
        <div id='navigation-title'><hh1>__navigation__</h1></div>
        <div id='menu'><span><a href='./index.html'>Contents</a></span>
                <li><a __current__ href='__menu_href__'>__menu_name__</a></li>
        <div id='content'><div id='content-box'>__content__</div></div>
    <div id='bottom-banner'>
        <div id='copyright'><span>Created, written by EelVex&reg; -- Updated: __update__</span></div>

Valid keywords
Keyword description source
meta Each page's metadata declared in content
title Each page's title declared in map
navigation Each page's navigation path calculated from map
menu_replace, menu_start, menu_end "Put site menu here"  
menu_href, menu_name Menu entries calculated from map
content Each page's content declared in content
update Each page's update date calculated during build


The map describes the structure of the site.

It is formated as #filename$Title$optional description for main pages or *filename$Title$parent for subpages. For example:

#index$Home title$Description of index page
#page1$Title 1$Optional description of page 1
#page2$Title 2$Optional description of page 2
*subpage1$Subpage title$page1  <- parent is page1
*subpage2$Subpage title$page1
*subsubpage$Title$subpage1  <- parent is subpage1


Content is the raw content (no headers, footers etc) of each page but the first line includes the title and metadata info of the page. Eg:

Page title$meta data
<div>Lorem ipsum dolor sit amet...</div>


Repository: at github and at gitorious.

Using git:git clone git://

shsite script 18 KB

See also

Remake: shsite2.

No tips yet.
Be the first to tip!
Like this post? Tip me with bitcoin!


Share on RedditShare on FacebookShare on Google+Tweet about this on TwitterShare on StumbleUponPrint this page

no comments

RSS / trackback


Real Time Analytics