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

Note

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.

Environments

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
[production]

# Set site root directory, mandatory.
base_url=http://localhost:8000

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

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

# Toggle sitemap generation. Default True, optional.
#exclude_sitemap=False

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

# Toggle copy or make symlink to include directory in site directory
# Default False, optional.
#symlink_include

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

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

# If set, report warning if page description length is outside the given range.
# Default None, optional.
#description_length_range=100-130

# If set, report warning if page title length is outside the given range. Optional.
#title_length_range=40-60

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

# 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
#search_xpaths=/html/body

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

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

# RSS feed title. Default '', optional.
#rss_title

# RSS feed description. Default '', optional.
#self.rss_description=''

# Tag pages parent url. Default tag, optional
#tag_url=tag

# Tag page title. Default Tags, optional
#tag_title=Tags

# Category pages parent url. Default category, optional
#category_url=category

# Category page title. Default Categories, optional
#category_title=Categories

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

# If deploy mode is ftp, need to set the following
#ftp_host=
#ftp_username=
#ftp_password=
#ftp_target_directory=

Example site configuration

::

[prod] base_url=http://pagegen.phnd.net 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.