From de6e35c52fcdb2df7f8b156d72e3588d64f2abc5 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Wed, 31 Jul 2024 06:59:05 -0600 Subject: [PATCH] infra: add robots.txt for GH Pages previews Block *everything*. We do not want any of this to be indexed, because we *only* use it for previews, and do not want its content to be cached or (especially!) surfaced to readers, since it may have a variety of issues ranging from pedagogical missteps to outright errors! --- ADMIN_TASKS.md | 10 ++++++++++ tools/generate-preview.sh | 4 ++++ tools/preview-robots.txt | 2 ++ 3 files changed, 16 insertions(+) create mode 100755 tools/generate-preview.sh create mode 100644 tools/preview-robots.txt diff --git a/ADMIN_TASKS.md b/ADMIN_TASKS.md index 7e9ba2cc04..9caff3004c 100644 --- a/ADMIN_TASKS.md +++ b/ADMIN_TASKS.md @@ -133,3 +133,13 @@ $ dot dot/trpl04-01.dot -Tsvg > src/img/trpl04-01.svg In the generated SVG, remove the width and the height attributes from the `svg` element and set the `viewBox` attribute to `0.00 0.00 1000.00 1000.00` or other values that don't cut off the image. + +## Publish a preview to GitHub Pages + +We sometimes publish to GitHub Pages for in-progress previews. The recommended +flow for publishing is: + +- Install the `ghp-import` tool by running `pip install ghp-import` (or `pipx install ghp-import`, using [pipx][pipx]). +- In the root, run `tools/generate-preview.sh` + +[pipx]: https://pipx.pypa.io/stable/#install-pipx diff --git a/tools/generate-preview.sh b/tools/generate-preview.sh new file mode 100755 index 0000000000..c2b0f2f1da --- /dev/null +++ b/tools/generate-preview.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +mdbook build +cp ./tools/preview-robots.txt ./book/robots.txt diff --git a/tools/preview-robots.txt b/tools/preview-robots.txt new file mode 100644 index 0000000000..1f53798bb4 --- /dev/null +++ b/tools/preview-robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /