Skip to content
This repository has been archived by the owner on Nov 12, 2017. It is now read-only.
/ mkblog Public archive

Static blog generator using Django templates

Notifications You must be signed in to change notification settings

scvalex/mkblog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

mkblog
======

Static site generator

* What

  mkblog.py generates a static site by passing the sources through jinja2.

* Behaviour

  When run, mkblog.py:

    - reads its settings from settings.py in the current directory

    - reads every file under SRC_DIRS and outputs a corresponding file
      under DEST_DIR flattening any hierarchies
        + each file with an INTERESTING_EXTension is run through
          jinja2
	+ if a Python module with the same name (plus .py extension)
          is present, it is read and the variable context is passed on
          to jinja2

* Settings

  All settings are saved in settings.py in the directory where
  mkblog.py is run.

  Configuration variables:
    - TEMPLATE_DIRS :: directories where mkblog.py searches for
                       templates
    - SRC_DIRS :: directories of source files
    - DEST_DIR :: directory (note the singular) where the output is
                  saved
    - INTERESTING_EXTS :: list of extensions mkblog.py should consider
         (all other files are ignored)

  Example settings.py:
      settings = { "TEMPLATE_DIRS": ( "pages/templates", ),
                   "SRC_DIRS": ( "/home/scvalex/blog", ),
                   "DEST_DIR": "pages/blog",
                   "INTERESTING_EXTS": ( "html", ) }

    Note that TEMPLATE_DIRS and DEST_DIR are relative, but SRC_DIRS
    are absolute.

* Extended Context

  Template files can use the following variables:
    - pages :: list of Pages (ALL relevant files in SRC_DIRS); each
                 entry contains:
                 + everything in the associated module (I like to
                   include date, title, tags, etc.)
                 + blocks :: a dictionary with all the text blocks in
                             the page

About

Static blog generator using Django templates

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages