SWG

A static website generator
Download

SWG Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Publisher Name:
  • Simone Margaritelli
  • Publisher web site:
  • http://www.github.com/evilsocket/

SWG Tags


SWG Description

A static website generator SWG is a new generation static website generator tool, featured by the Mako template system, born from the need to have both performances and "WEB 2.0" contents and capabilities.Given a set of files, one for each page/article, one for each author and one for the categories hyerarchy, SWG will read the configuration file you specify from command line and generate a complete static website, with tags and categories indexing.InstallationTo get the latest released version:pip install swgCreate a new websiteTo start a new website, type:swg --create website-folder-nameAn example site with a basic structure will be created inside the 'website-folder-name' directory. Then you can type:cd website-folder-nameswg --serveTo test the website locally. The first article is about customization and basic configuration, so read it carefully.Generate your websiteOnce you are in the directory containing your website definition (with a swg.cfg file in it), just run:swg --generateTo start website generation, other options are available, useswg --helpTo a display the complete list.Importing from another platformRight now, in the 'importers' directory of the project, there's a script to convert a WordPress XML backup file to the SWG format, to use it consider the following:python wordpress.py --help- SWG Wordpress Backup Importer -Usage: wordpress.py -i wordpress-backup.xml -u 'http://www.your-site-url.com' < options >Options: -h, --help show this help message and exit -i WPBACKUP, --input=WPBACKUP The Wordpress XML backup file. -u SITEURL, --url=SITEURL URL of the destination website. -o OUTDIR, --output=OUTDIR Output directory, default is the current working directory. -e FILEEXT, --extension=FILEEXT Output file extension, default is txt. -I IMGDIR, --images=IMGDIR If specified, it's the path where the importer will try to download images referenced by articles.So let's say for instance, that you have your wp.xml file and you want to export it to the 'example-site.com' directory, downloading images referenced by the articles into the 'example-site.com/images' directory (the import will replace properly image urls), you will use the command line:python wordpress.py -i wp.xml -u http://www.example-site.com -o 'example-site.com' -I 'example-site.com/images'And it's all done! Now you just have to create the templates, fix the categories hyerarchy inside the file 'example-site.com/db/categories.txt', customize your own description inside 'example-site.com/db/your-nickname.txt' and make the configuration file following the example below.An example configuration file# DB files extensiondbitem_ext = txt# URL of the site you are going to generatesiteurl = http://www.example-site.com# Site name / descriptionsitename = An example site generated by SWG# Site charsetcharset = utf-8# Site languagelanguage = it# Comma separated site keywordskeywords = some, html, keywords, here# Site destination basepathbasepath =# Site page files output extensionpage_ext = html# Generated site output pathoutputpath = out# Items (dirs or files) to copy from datapath to outputpath (eg. static files, css, etc)copypaths = css, images, .htaccess# Command to execute once the generation is finished, for instance an rsync :)transfer = rsync -ravz out/* -e ssh user@example-site.com:/var/www/example-site.com/htdocs/# Enable or disable the pager on categories, index, tags and author pagespager = true# If pager is enabled, this is the maximum number of items per pageitems_per_page = 10# Compress pages (ie. index.html.gz) and create (or update) .htaccess file to serve them as html filesgzip = true# Compression level, 0 to 9compression = 9# Clean output html with TIDYtidyfy = truePretty self explanatory isn't it ?Testing your website locallyFrom version 1.2.4, SWG offers the possibility to test your website locally, once you are in the directory containing your website definition (with a swg.cfg file in it), run the following command:swg --serveThis will start the website generation and a test webserver on http://localhost:8080/ .Example projectFor an example site, look at my personal blog github repo located here https://github.com/evilsocket/evilsocket.net Requirements: · Python


SWG Related Software