Publishing docs — all chapters
What it is for
Object storage is cheap, and it scales without you thinking about it. Selfish uploads to Amazon S3 or to any service that speaks the same language: Cloudflare R2, Backblaze B2, DigitalOcean Spaces, MinIO and others.
Create a bucket and an access key in your provider’s console first. Then, in Site Settings → Publishing, set Publish Using to S3 Storage.
The bucket
| Field | What to enter |
|---|---|
| Bucket | The bucket’s name, for example my-site-bucket. |
| Region | The bucket’s region, for example us-east-1. Use auto for Cloudflare R2. |
| Endpoint | Leave it empty for Amazon S3. For other services enter their endpoint host: <account-id>.r2.cloudflarestorage.com for R2, s3.us-west-004.backblazeb2.com for B2, and so on. |
| Path Prefix | Optional. Publishes the site under a folder inside the bucket, for example blog. |
The access keys
| Field | What to enter |
|---|---|
| Access Key ID | The key’s ID from your provider, for example AKIA…. |
| Secret Access Key | The secret that goes with it. It is stored in the Keychain only. |
Use a key limited to just this bucket. It needs to list, read, write and delete objects there, and nothing else. If a device were ever lost, that is all the key could touch.
Serving the site
Storage holds the files. You choose how readers reach them.
- Amazon S3: turn on static website hosting for the bucket, or put a CDN in front of it.
- Cloudflare R2: connect a custom domain to the bucket.
Then set Site URL to that address.
If you turn on addresses without .html, a post lives at /posts/my-post/. Amazon S3 shows a folder’s address only with static website hosting turned on, or behind a CDN set to add index.html. Selfish reminds you when you switch it on.
What a publish does
- Only files that changed are sent, and files your site no longer has are removed. Selfish removes only what it recorded uploading.
- Every file is stored with the right content type, so audio plays and pages render.
- Every file tells browsers how long to keep it: pages, feeds and the stylesheet are checked on each visit; photos and other media are kept for a week; icons for a day; and anything else, such as share cards and the search script, for an hour.
- The record of what was uploaded is
.selfish-manifest.json, next to your site.
For a themed “Page not found” page, point your bucket’s or CDN’s error document at 404.html.
Problems? See Troubleshooting.