Static sites

Last verified

Picked Static site (or Astro, which is a static site too)? Your site serves files and nothing else: HTML, CSS, JavaScript, images, fonts. There is no PHP, no Node.js and no database, so there is nothing to update or patch. Use it for a brochure site, a landing page, documentation, or the output of a static site generator such as Astro, Hugo, Eleventy or Jekyll.

What you get

  • nginx serving your files, with HTTPS, your domain, backups and monitoring as on every other site.
  • Until you publish, visitors see a holding page with your site's name and Something new is on the way.
  • No database. The site's Databases tab says so, and offers Create a site that can use a database if you need one.

Publish your files

  1. Build your site on your computer if it uses a generator (Astro: npm run build, Hugo: hugo). The result is a folder such as dist/ or public/ with an index.html in it.
  2. Zip that folder. A zip that holds one folder is unpacked into the top of your site, so zipping dist/ itself works.

Caution: Uploading replaces what is live on your site now.

  1. Open Sites → your site → Deploys, open Upload files and press Upload & publish.

Upload your website has the details, and the SFTP route for bigger sites. If you upload a single HTML file with another name, it becomes your home page.

Publish from Git

You can also connect a repository on the Deploys tab (Deploy from Git). What visitors see depends on whether the deploy builds anything:

  • A generator project (Astro, Vite, Eleventy and the like) with a package.json: each deploy runs your build script, and when the build creates a dist/, build/, out/ or _site/ folder with an index.html in it, that folder is what visitors see. Astro and Vite write dist/. The public/ folder of such a project holds source assets, and the build copies them into dist/ for you.
  • Plain HTML, or a project with no build: the top level of your repository is served, or its public/ folder when the repository has one.
  • A build folder you commit yourself is treated as plain files, not as the build: put committed, finished files at the top level or in public/.

The Repository layout panel says so for a generator project: "On a static site we publish the folder the build creates — dist/, build/, out/ or _site/ — not the repository." If the deploy log says "the build wrote no dist/, build/, out/ or _site/ with an index.html", the build put its files somewhere else; set your generator to write to dist/, or upload the build instead (above).

Things a static site does not do

  • No server code. A PHP file downloads as text instead of running. For PHP pick Any PHP app or Laravel; for a Node.js server pick Any Node.js app (Node.js apps).
  • No fallback page. A path with no matching file returns 404 Not Found. A single-page app that routes in the browser shows a 404 when a visitor reloads a deep link; use hash routing, or have your generator write one HTML file per page.

Tip: Visitors' browsers keep CSS, JavaScript, images and fonts for a long time. When you change one, give it a new file name (generators do this for you with hashed names) so visitors get the new version.

Stuck? Contact support — replies within one business day.