Keep media in a bucket

Keep new pictures, PDFs and videos in a bucket of your own instead of the site's repository, and move the ones already there.

Before you start A Cloudflare R2 or Amazon S3 bucket with a public address, and a key for it.

  1. Open Media and press Keep media outside the repository. Choose the kind of bucket — Cloudflare R2 here.

    You’ll see: The window lists what to do at the provider: make the bucket, give it a public address, make a key.

    The Keep media in a bucket window over the Media screen: Which kind of bucket, with Cloudflare R2 (Recommended) chosen above Amazon S3, Another S3-compatible store and Cloudflare Images, and under them the first of R2's steps, Make the bucket.
  2. Fill in the Account ID, the Bucket name, its Public address and the key you made, then press Check and connect.

    You’ll see: Galley checks for real before it saves: it puts a small test picture in the bucket, reads it back, loads it from the public address and removes it. When a step fails, it says what to change.

    The same window further down, filled in: the Account ID, the Bucket name caddow-media, the Public address https://media.example.com, an Access Key ID and a Secret Access Key shown as dots, above Check and connect.
  3. Press Upload, or drop a file anywhere on the screen.

    You’ll see: The file goes to the bucket, not the repository, and the message says so. A page that uses it stores its full address.

    Media with a bucket connected: New files go to Cloudflare R2 (caddow-media) and are loaded from media.example.com, with Storage settings; spring-lookbook-cover.webp first among the photographs, marked New, and the message that it is in the bucket.
  4. Use the picture on a page as you would any other, then choose it in Media.

    You’ll see: Kept in says where the file is. Used on lists every page that uses it, published or not.

    Media with spring-lookbook-cover.webp chosen: beside the photographs, its details — its size, Kept in The bucket (Cloudflare R2), Status, and Used on The atelier — with Open full size and Delete for good.
  5. To take a file out of the bucket, press Delete for good, then Delete file.

    You’ll see: A file a page still uses is not deleted, and the message names the page. Take it out of the page and publish first.

    The same screen after trying to delete the picture: the message spring-lookbook-cover.webp wasn’t deleted — a page still uses it, src/content/pages/atelier.md; take it out of that page and publish first.
  6. To move the files already in the repository, open Storage settings and press Move the repository’s files to the bucket…. Read the plan, then press Move them.

    You’ll see: The plan says what leaves, what stays and why. Pages and page templates will point at the new addresses, and the repository’s copies are removed. A copy stays only while a file the site is built from still uses it and a move doesn’t change that file: the plan names the file and says how to move the rest. Other files that mention a picture, a README for one, are listed under Also mentioned in and left as they are. If your site’s build does read one of them, name it in the site’s settings first, as that line says.

    The Move the files to the bucket? window over Storage settings: how many files will be copied to the bucket, how many places in how many pages and page templates will point at their full addresses, how many of the repository’s copies are then removed and how many stay, the file that still uses those and why a move doesn’t change it, a second paragraph naming the other files that mention them and aren’t changed, the choice Keep the repository’s copies too, and the buttons Not now and Move them.
  7. When it has finished, press Review in Proof.

    You’ll see: The pages and page templates point at the bucket now and the repository’s copies are gone, all as changes waiting in Proof: publish to make it live. The message says again what stayed and why, and the list under it names each file that stayed with what still uses it.

    Media after the move: The files were moved to the bucket, just now, with how many files were copied, how many pages and page templates were updated, how many copies were removed from the repository and how many were left, the file that still uses those and why they stay, the other files that mention them and were not changed, a list of the files that stayed, and Review in Proof.