A simple static website generator. I use it for my persal website, found here.
- Create static websites from markdown files
- Jinja2 templating
- Automatic site rebuilding (no need to rebuild after every change)
- Basic webserver for testing included
- Automated publishing to github (with git)
If no project or path is specified then statwebgen will try to use the present working directory.
To create a new website:
statwebgen.py --create [--skeleton SKELETON] [--project PROJECT] [path]
- If a project skeleton is specified then the new project will be created from the skeleton.
- If a project name is specified then the project and the associated project path will be saved in the config file.
- If no path is specified the current working directory will be used instead
To rebuild a static webite:
statwebgen.py --build [--watch] [--project PROJECT] [path]
The --watch argument will automatically regenerate the website on changes.
To serve a website:
statwebgen.py --serve [--open] [--watch] [--project PROJECT] [path]
The serve command will try to serve from the .build folder by default (if a project name is specified). The open option opens the served website in the default browser. The watch option automatically rebuilds the websites if any files are changed.
A new webpage can be added by creating a new markdown file in the project directory. The page's layout and styling can be changed by editing the used templates and/or stylesheets.
The markdown file can (but is not required to) include meta-data for usage in template files. To use meta-data tags in html templates, simply place an '$' character followed by the tag's name in the template and statwebgen wil automatically replace it with the tag's value.
The following meta-data tags are recognized and used by statwebgen. They will be replaced by default values if no value is set:
- Template: the template file that is used.
- Stylesheets: a comma-delimited list of css stylesheets that will be applied to the used template
- Scripts: a comma-delimited list of scripts that should be included
Meta-data loading ends when a "---" string is encountered. Page content should be added after this string. For example, an about page could look as follows:
Template: page.html Title: About Description: About page. Created: 01/11/2016 Updated: 13/11/2016 Scripts: [default.js, somescript.js] --- My name is Jelle Pelgrims. I'm a university student in Belgium working on some personal projects in my free time. I have experience in the following subjects: * Software development in Python and C# * Web development in HTML/CSS/JS * Automated trading and game development * Economical theory, modelling and simulations * Dutch, English and Swedish
The static website can then be generated by simply running the build command in the shell. All markdown files found in the project directory (and subdirectories) will automatically be converted to html and saved in the output directory. All non-markdown files will be copied to the output directory. File hierarchy is maintained during site generation.
By default all files in folders (if present) starting with a dot ('.') will be ignored while building and publishing.