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
- 1Set baseURL in hugo.toml to your production domain.
- 2Optionally add HUGO_VERSION as an environment variable.
- 3Connect the repository and deploy.
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.
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]}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 engineThings 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.
| Limit | Free | Pro |
|---|---|---|
| Build minutes | 3,000/mo, 1 concurrent | 10,000/mo, 3 concurrent |
| Function memory / timeout | 1 GB / 300 s | 4 GB / 1800 s |
| Function invocations | 2 M/mo | 20 M/mo |
| Bandwidth | 150 GB/mo | 2 TB/mo |
Related guides
- Deploy a Eleventy siteEleventy (11ty) sites built into _site.
- Deploy a Static HTML sitePlain HTML, CSS and JavaScript, no build step.
- Deploy a Docusaurus siteDocumentation sites from docusaurus build, with previews for every docs branch.
Ship your Hugo project tonight
Connect the repository and the build settings fill themselves in. Free plan, no card.