Site generation

On generation Pagegen will build site from pages in content directory. The command must be run from the Pagegen root directory or one of its sub directories.

$ Pagegen --generate


If more than one sections defined in site.conf, use argument --environment <section name> or define default_environment=True in appropriate section.

After generation the generated HTML will be in the site directory/<environment>, simply copy this directory to your web server to go live:)

Site generation involves first creating page HTML in the site directory, creating sitemap and copying include directory to the site directory.


Pagegen supports defining settings for multiple environments, so that the site may be generated with variations. The environment is also available as an environment variable to the hook scripts to allowing making customizations for the various environments.

A test environment could be generated with settings for absolute paths and .html extension so can test locally without web server, whilst a production environment may have no .html extension for clean urls and the post_generate hook could copy the site to FTP server.

If only one section is defined in site.conf or a section has set default_environment=True then no need to specify the environment when running pagegen. If multiple environments then specify with --environment <environment>.

Site configuration (site.conf)

Site generation can be configured by the site.conf, found in the Pagegen root directory.


# Set site root directory, mandatory.

# Specify default extension, if file does not already have one. Default None, optional.

# Toggle sitemap generation. Default True, optional.

# Toggle relative or absolute URLs. Default True, optional.

# Toggle include page titles in content. Default False, optional.

# Toggle index file in URL for directories. Default True, optional.

# If set, report warning if page description length is outside the given range.
# Default None, optional.

# If set, report warning if page title length is outside the given range. Optional.

# If set, generate search index file (/search-index.json). Search requires template/javascript. Default False, optional

# Specify xpaths to the parent nodes whos children will be searched for terms to index. Multiple xpaths can be specified by separating with comma. Optional, default is /html/body

# If set, generate rss feed containing all pages with header "rss include" set to True.
# Default False, optional.

# RSS feed max items in feed. Default 15, optional.

# RSS feed title. Default '', optional.

# RSS feed description. Default '', optional.

# Tag pages parent url. Default tag, optional

# Tag page title. Default Tags, optional

# Category pages parent url. Default category, optional

# Category page title. Default Categories, optional

# Name of custom script in deploy_scripts directory used to deploy site, must be executable. Script '' is shipped with pagegen and requires further configuration settings. Default None, optional

# Minify html files, Default False, optional

# Minify css files in include directory, Default False, optional

# Minify javascript files in include directory, Default False, optional

Example site configuration



To generate prod environment run the following.

pagegen -g -e prod