On this page

Please contact us if you need help or have any questions!

Build configuration

We will try to determine the static site generator you use automatically and build your site appropriately. However, this might not always succeed - or you might want more control over how your site is built. In this case, create a statichost.yml configuration file in the root of your repository. The available configuration options are:


# Docker image to use for building
image: jekyll/jekyll:3.8
# Build command
command: jekyll build
# Public directory
public: _site

The build command is the command expected by the docker image in question, and might thus not be exactly the same command needed for the normal CLI of your static site generator. The public directory is relative to the repository root.

The example above will in practice run a Docker container like so: docker run jekyll/jekyll:3.8 jekyll build with the repository root as the working directory. After the build is done, the contents of the _site directory are published.

Publish only

The image and command options above are optional. If you do not specify an image to run, the contents of the public directory will be published as-is without any build step.

The most minimal configuration that just publishes the entire contents of the repo is thus:


# Public directory is a dot, i.e. repository root
public: .

Environment variables

If you need environment variables (such as auth tokens) as part of your build, please contact us, and we'll sort it out.

Custom domains

In order to use your own domain for your site, you just need to do two things:

  1. Add a statichost.yml configuration file (or edit your existing file) and add your domain via the domains property.
  2. Add a CNAME DNS record from your domain to


  # Primary domain
  # Domains that redirect to the primary

The domains property should be an array / list of strings. The first domain on the list is the primary domain. All the other domains on the list will redirect to the primary domain.

Remember to add DNS records not only for your primary domain, but also all redirect domains.

You can add your domain(s) at any time to the configuration file - there is no need to configure DNS beforehand. In fact, we recommend that you first add your custom domains to the configuration file, build your site, and only after that change your DNS settings. When we receive the first request using your custom domain, we will create any SSL certificates and other configuration on-demand. This ensures that there is no down-time while you switch to

Note that you need to build your site after making changes to domains in order for the changes to be picked up.

Root domains

If you want to use the root of a domain (e.g. as either the primary domain or a redirect domain, a CNAME DNS record will not work. In this case - for any root domains - either use an ALIAS (or similar, depending on your DNS provider) record, or add an A record pointing to our main server at

Automatically deploy changes

In order to build and publish your website automatically, you need to add webhooks to your provider of choice. This is the main way site builds are triggered. Just point the webhook to the following URL and when a webhook is sent, we'll rebuild and publish your site!

Examples of how to do this for various providers are listed below.


  1. Navigate to the repository of your site.
  2. Go to the Settings tab.
  3. Click on the Webhooks tab.
  4. Click on the Add webhook button.
  5. Enter the URL above (with your actual site name) in the payload URL field.
  6. Select application/json as the content type.
  7. Select Just the push event.
  8. Press Add webhook.

Private repositories

If your repository is private, we'll create an SSH key pair for you and send you the public key to add to your repository settings. How this is configured will vary by provider, but below are some examles (we will of course help you set this up on other providers as well).


  1. Navigate to the repository of your site.
  2. Go to the Settings tab.
  3. Click on the Deploy keys tab.
  4. Click on the Add deploy key button.
  5. Choose a name, such as "statichost publish" and paste in the provided key under Key.
  6. Press Add key.

Redirects and rewrites

You can add redirects to your site e.g. if you have changed the structure of your site but want to keep old links working (as you should). Just add a _redirects file with your redirects to the root of your public folder. The file should list one redirect per line: first the URL that should be redirected, followed by any whitespace, followed by the URL to redirect to. The URL to redirect to can be an absolute URL leading to another domain.

Optionally, you can specify the HTTP code used for the redirect after the redirect specification. By default the redirect is a temporary redirect (technically a 302 Found HTTP status code).

Example _redirects file:

/my/old/post.html    /posts/old/    301
/alternative/page/   /primary/page/

Rewrites, i.e. proxying

It is also possible to rewrite or proxy a request to either a page on the site itself (e.g. for SPA applications) or to a URL on a completely different service (e.g. for proxying API requests). This feature is currently in private beta testing.

Contact support in order to enable rewrites on your site.