Learn

Static Site Generator

Export your site as flat HTML

As of v1.10, Statamic provides a way for you to export your Statamic site into flat HTML files ready to be deployed onto a server.

You can access the Generator in the Control Panel by going to System > Export to HTML.

Clicking Generate HTML Files will go through your _content folder and save the pages into a directory. This might take a while depending on amount of pages in your site.

Assets and theme files will automatically be copied over for you.

Once completed, you can download a zip of the entire site using the Download Site button.

Configuring

You can configure the generator by editing the _config/bundles/generator/generator.yaml file.

destination

The folder (from root) where your site will be saved. By default this is _static

copy

An array of folders that will be copied into the destination folder.
By default these are:

  • _themes/{theme}/css
  • _themes/{theme}/img
  • assets

{theme} will be replaced by the name of your theme.

urls

A list of URLs that should also be generated.
This is useful if you have custom routes set up or use taxonomies.

urls:
  - /an/arbitrary/url
  - /blog/categories/{taxonomy:categories}
  - /portfolio/{taxonomy:tags}

The {taxonomy:[type]} tag will be swapped out with every taxonomy of that name. So in the above snippet, the generator will visit /blog/categories/wilderness, /blog/categories/survival, etc.

secret_key

If you’d like to be able to generate by hitting a URL (e.g. deployment post-hooks), you can set a secret keyword. Your URL would then be:

example.com/TRIGGER/generator/fire/{{ secret_key }}

throttle

The throttle is the minimum time in seconds between generations (default is 1800). This will prevent things like spiders and stray scripts from potentially flooding your cpu with a lot of work generating the site over and over again.

This article was last updated on March 30th, 2016. Find an error? Please let us know!