Static HTML

Using the rsconnect CLI

This example command deploys a static html file to Posit Connect, assuming that we set up a server named myServer when configuring our account:

rsconnect deploy html -n myServer index.html

Deploying a single html file

Specifying a file in the path results in that file, not the entire directory, being included in the deploy bundle.

e.g. using the following directory,

├─ my_project/
│ ├─ index.html
│ ├─ second.html

and the following command:

rsconnect deploy html -n myServer my_project/second.html

we will have a bundle which includes second.html.

Deploying a directory containing html file(s)

Specifying a directory in the path results in that entire directory, subdirectories, and sub contents included in the deploy bundle. The entire directory is included whether or not an entrypoint was supplied.

e.g. using the following directory,

├─ my_project/
│ ├─ index.html
│ ├─ second.html

and the following command:

rsconnect deploy html -n myServer my_project

or this command:

rsconnect deploy html \
    -n myServer my_project \
    -e my_project/index.html

we will have a bundle which includes both index.html and second.html.

Specifying an entrypoint

Providing an entrypoint is optional if there’s an index.html inside the project directory, or if there’s a single html file in the project directory.

If there are multiple html files in the project directory and it contains no index.html, we will get an exception when deploying that directory unless an entrypoint is specified.

If we want to specify an entrypoint, and we are executing the deploy command outside a project folder, we must specify the full path of the entrypoint:

rsconnect deploy html \
    -n myServer my_project \
    -e my_project/second.html

If we want to specify an entrypoint, and we are executing the deploy command inside the project folder, we can abbreviate the entrypoint, like so:

cd my_project
rsconnect deploy html -n myServer ./ -e second.html

Including Extra Files

If we want to include extra files in bulk to make them available when our html file is served by the Posit Connect server, the directory deployment method mentioned above is the easier method. But if we want to to selectively add files to the deployment bundle , we can specify the extra files on the command line after the path:

e.g. using the following directory,

├─ my_project/
│ ├─ index.html
│ ├─ second.html
│ ├─ third.html
│ ├─ fourth.html
cd my_project
rsconnect deploy html \
    -n myServer \
    index.html \
    third.html \
    fourth.html

we will have a bundle which includes index.html, third.html and fourth.html.