diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index d998e8f..b8c59de 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -44,3 +44,6 @@ jobs: publish_branch: gh-pages publish_dir: site/dist force_orphan: true + # Keep the custom-domain CNAME file on gh-pages; without this, + # force_orphan would delete it on every deploy and detach the domain. + cname: progit3.com diff --git a/site/README.md b/site/README.md index f709e14..82c715b 100644 --- a/site/README.md +++ b/site/README.md @@ -62,8 +62,8 @@ The file name (without `.mdx`) becomes the URL: `/blog//`. publishes `site/dist/` to the `gh-pages` branch with [peaceiris/actions-gh-pages](https://github.com/peaceiris/actions-gh-pages). Point GitHub Pages at the `gh-pages` branch (Settings → Pages → Deploy from a -branch) and the site is served at . +branch) and the site is served at . -The canonical URL and base path default to `https://progit.github.io` and -`/progit3`; override them with the `SITE_URL` and `BASE_PATH` environment -variables (e.g. for a fork or a custom domain). +The canonical URL and base path default to `https://progit3.com` and +`/`; override them with the `SITE_URL` and `BASE_PATH` environment +variables (e.g. for a fork served at `https://.github.io/progit3/`). diff --git a/site/astro.config.mjs b/site/astro.config.mjs index c2a51c3..406804c 100644 --- a/site/astro.config.mjs +++ b/site/astro.config.mjs @@ -2,10 +2,10 @@ import { defineConfig } from 'astro/config'; import mdx from '@astrojs/mdx'; -// GitHub Pages project site: https://progit.github.io/progit3/ -// Override SITE_URL / BASE_PATH for forks or a custom domain. -const site = process.env.SITE_URL ?? 'https://progit.github.io'; -const base = process.env.BASE_PATH ?? '/progit3'; +// GitHub Pages with a custom domain: https://progit3.com/ +// Override SITE_URL / BASE_PATH for forks (e.g. https://.github.io and /progit3). +const site = process.env.SITE_URL ?? 'https://progit3.com'; +const base = process.env.BASE_PATH ?? '/'; export default defineConfig({ site, diff --git a/site/scripts/build-book.mjs b/site/scripts/build-book.mjs index 41ff942..f27b4cd 100644 --- a/site/scripts/build-book.mjs +++ b/site/scripts/build-book.mjs @@ -22,7 +22,7 @@ import { fileURLToPath } from 'node:url'; const siteRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); const repoRoot = path.resolve(siteRoot, '..'); -const base = (process.env.BASE_PATH ?? '/progit3').replace(/\/+$/, ''); +const base = (process.env.BASE_PATH ?? '/').replace(/\/+$/, ''); // --------------------------------------------------------------------------- // 1. Make sure book/contributors.txt exists (mirrors the Rakefile task).