Rendez-vous sur Arrakis

C'est lorsque nous croyons savoir quelque chose qu'il faut justement réfléchir un peu plus profondément. F. Herbert

swx - static site generator

swx is now here : swx.

This page in french

swx is a tool to generate a static website from a file tree written in [markdown], [txt2tags] or any other markup language.

It does'nt require any other tool except usal commands (cp, sed…) and the markup parser.

Inspired by sw, swx will generate you html pages, create links between them in a menu. You cas use simple css and templates that will be included in your pages.


Example : source tree


will become in output



Download files here here


Simple run :

./swx directory_containing_website

then, push you site the way you prefer with mercurial, git, rsync or even ftp


To configure, edit swx.conf

You can change uppercase variables to fit your needs

Modyfy how your site looks with style.css


mkdir dossier
cd dossier
tar xvzf swx.tgz
mkdir monsite
vim monsite/
vim monsite/
mkdir monsite/dossier1
vim monsite/dossier1/
./swx/swx monsite 

Appears monsite.static containing every pages converted to html and a new file swx.log containing the list of news pages (used later)

RSS feed

Use swx_rss to generate feed.xml

./swx_rss > DESTDIR/feed.xml

Replace DESTDIR the path to the output directory

Site map

Generate a list of pages in your site with

    ./swx_plan DESTDIR > DESTDIR/Divers/map.html

And replace of course : DESTDIR

Sitemap generator

    ./swx_sitemap DESTDIR > DESTDIR/sitemap.xml

Then, you can compress it :

    gzip --best -c DESTDIR/sitemap.xml > DESTDIR/sitemap.gz

Don’t forget to edit robots.txt

User-agent: *


Example Makefile to edit to fit your needs:

    ./swx $(SOURCEDIR)
    ./swx_gopher $(SOURCEDIR)
    ./swx_sitemap  $(DESTDIR) > $(DESTDIR)/sitemap.xml
    gzip --best -c $(DESTDIR)/sitemap.xml > $(DESTDIR)/sitemap.gz
    ./swx_plan $(DESTDIR) > $(DESTDIR)/siteplan.html
    ./swx_rss > $(DESTDIR)/feed.xml
    ./swx_blog $(DESTDIR)/index.html
    rm -rf *.static
    rm swx.log
    find Rendez-vous_sur_Arrakis -exec touch {} \;
    make all
    cd $(DESTDIR) && python3 -m http.server && x-www-browser http://localhost:8000

Then, just run :

The end

Most of script can be improved, and simplified.

Avoid weird file names (use detox!)

Do not hesitate to contact me for any suggestion here