Skip to content

Static sites and SPAs

Deploy a Hugo site on Enzonic

Deploy builds Hugo sites with Hugo extended, which it downloads into the build sandbox when needed. The default version is 0.139.0; set HUGO_VERSION in the project's environment variables to pin another one.

At a glance

What Enzonic Deploy does with a Hugo project when you connect it. You can override any of it in the project settings.

Language
Go templates
Detected from
hugo.toml, or a config.* file with a content/ or layouts/ folder
Build command
hugo --gc --minify
Output
public
Runs as
Static

How it runs

  • Static

    Always.

Deploy Hugo step by step

  1. 1Set baseURL in hugo.toml to your production domain.
  2. 2Optionally add HUGO_VERSION as an environment variable.
  3. 3Connect the repository and deploy.
hugo.toml
baseURL = 'https://example.com/'
languageCode = 'en-us'
title = 'My site'

Connect a database to Hugo

Create a database on Enzonic Databases (or from the project's settings) and its connection string is added to the project's environment variables. This example uses PostgreSQL.

api/search.py
import os, psycopg

def handler(request):
    q = request.query.get('q', '')
    with psycopg.connect(os.environ['DATABASE_URL']) as conn:
        rows = conn.execute("select title, url from pages where title ilike %s limit 10", (f'%{q}%',)).fetchall()
    return {'results': [{'title': t, 'url': u} for t, u in rows]}
A static Hugo site can still have server code: this Python function in api/ answers /api/search.

Postgres projects get two variables: DATABASE_URL through the connection pooler for the app, and DATABASE_URL_UNPOOLED for migrations.

PostgreSQL on Enzonic DatabasesEvery database engine

Things to know

  • Themes added as git submodules must be reachable by the build; vendored themes (or Hugo modules) avoid surprises.

Plan limits that matter here

From the live plan data. Every plan includes previews for each branch, instant rollback, environment variables and logs.

Plan limits that matter for Hugo
LimitFreePro
Build minutes3,000/mo, 1 concurrent10,000/mo, 3 concurrent
Function memory / timeout1 GB / 300 s4 GB / 1800 s
Function invocations2 M/mo20 M/mo
Bandwidth150 GB/mo2 TB/mo

Compare every plan

Related guides

Ship your Hugo project tonight

Connect the repository and the build settings fill themselves in. Free plan, no card.

Start free