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

[TOC]

Description

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.

Use

To run shsite you need:

Usage:

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

Examples

To update page1.html, simply run:

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

Template

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"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang='el'>
    <head>
        <title>__title__</title>
        <meta name='Keywords' content='__meta__' />
        <link rel='stylesheet' title='Basic style' type='text/css' href='./style/index.css' />
    </head>
<body>

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

</body>
</html>
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

Map

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

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>

Download

Repository: at github and at gitorious.

Using git:git clone git://github.com/EelVex/shsite.git

shsite script 18 KB

See also

Remake: shsite2.

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

1LF6Z4LGKPgwVjsrQeYKBSyP1V9AeGgvT2

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

no comments

RSS / trackback

respond

Real Time Analytics