---
title: "pols publish"
description: "Publish a directory as a static site at <name>.on.pols.so"
---

<!-- Generated by scripts/reference.mjs from the pols CLI's --help. Do not edit; run `npm run reference:sync`. -->

A site is a static directory published from a sandbox, like a build's dist/,
and served by pols at https://\<name\>.on.pols.so: it stays up while the sandbox
is in standby, stopped or deleted. Every publish is a new version that never
changes; a site keeps its newest 10 (pols sites set `--keep`) besides the live
one, and pols sites restore makes an older one live again.

Sites are private: only your org's users, logged in at my.pols.so, can open
them. With `--access` link anyone with the site's share link can, with
`--access` public anyone. Leaving link access invalidates the share link.

Publish DIR of a running sandbox (one in standby is woken) as a new version
of a site and make it live. DIR is read in the sandbox, as the sandbox user
or `--user`; a relative DIR, or one starting with ~/, is in that user's home.
Without SANDBOX, DIR is a directory on this computer, uploaded: a .zip, or a
single file, is published as well. Regular files are published; symbolic
links, devices and dot files (except .well-known/) are skipped. Without `--site`
a new site with a generated name is made; a `--site` name that does not exist
yet is made with that name.

## Usage

```text
pols publish [SANDBOX] DIR [flags]
```

## Examples

```sh
pols publish web app/dist                  # a new site, private
pols publish web app/dist --site my-docs   # publish again to my-docs (made if new)
pols publish web /srv/www --site launch --access public
pols publish ./dist --site my-docs         # upload a local directory
```

## Flags

```text
    --access string   for a new site: private (default), link or public
-h, --help            help for publish
    --site string     the site to publish to, by ID or name; a new name makes the site (default: a new site with a generated name)
    --user string     the sandbox user who reads DIR (default: the sandbox user)
```

The [global flags](/docs/reference/cli/#global-flags) work with this command too.
