static website generator powered by Python, YAML, Python-Markdown and mustache.
There are many other and better staticsitegenerators, but I missed some features. So drfly provides:
- the meta information for rendering (template, menue etc) or html metatags are defined
- in
./meta.yaml
in the contentroot, like configuration files in most other ssg like hugo. - but additionally in every directory (
meta.yaml
) - or inside the page as jekylleske front matter, but at the bottom of the page and only optional (tried to use my own standard PROSErial).
- in
- the document or page title is defined with the first H1 and is optional.
Most other ssg define the pagetitle in the front matter, but this is complicated and makes front matter mandatory. HTML headings, are part already a part of the document. So I need this:
- define HTML Title element
<title>
from first markdown heading aspagetitle
if it is missing in meta (a function you have in MkDocs). - toc_depth range to exclude H1 from toc.
- define HTML Title element
- URLs with no mandatory trailing slash.
- simple one-file templating with mustache, for plain websites. Even the simple hugo layout templates drives me crazy. I would love using Pandoc for this.
- include sourcefiles in templates (for menus, sidebars, trackingpixels). Instead of defining menus in abstract config files.
- use source directories as namespace, with customizing namespaceseperators (
namespace:pagetitle
) and not only/
. - non .md files (
.css
,.js
or.txt
) get rendered with newlines as breaks (<br>
). - create single pages, not always all pages at once.
When I build sites for other people I use hugo.
But then I miss [[
Wikilinks]]
from Python-Markdown.
Change to source directory and render all pages:
cd /path/to/source/
drfly
Render all pages from source directory:
drfly /path/to/source/
Render single page:
drfly /path/to/source/index.md
You can use git{hu|la}b as content webinterface and versioning system.
Get new commits with webhook.py (depends on webpy.org)
pip3 install -r requirements-web.txt
python3.6 drfly/webhook.py 8080 /path/to/source/
- Render a single page:
http://localhost:8080/render?page=index.md
- Render all pages, by setting "webhook: renderall"
true
in config and:http://localhost:8080/render?all
- Pull git repository and render all changed pages
curl -X PO http://localhost:8080/gitpull
There is the global config drfly/meta.global.yaml.
You can overwrite this values with a file meta.yaml
in the root-directory oder every sub-directory.
Drfly renders html and json files with Python-Markdown using Markdown Extra with Table of Contents, WikiLinks, Sane Lists and Admonition.
You can add Third-Party-Extensions in config markdown: extensions: