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.

# Define settings for environment, must hava at least one section

# Set site root directory, mandatory.

# Specify section as default environment, if more than one section. Default False, optional

# 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 copy or make symlink to include directory in site directory
# Default False, 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

# Deploy mode currently may be 'ftp', Default None, optional

# If deploy mode is ftp, need to set the following

Example site configuration


[prod] base_url= absolute_urls=False page_titles=True

[test] default_environment=True base_url=http://localhost:8000 symlink_include=True

To generate prod environment run pagegen -g -e prod.