diff --git a/site/CLAUDE.md b/site/CLAUDE.md index cf762cca..71ad07ed 100644 --- a/site/CLAUDE.md +++ b/site/CLAUDE.md @@ -15,7 +15,7 @@ The site deploys via Netlify from two branches: | Branch | Deploys to | Content | | --- | --- | --- | | `site/v10` (production) | **videojs.org** | Stable docs matching the latest release | -| `main` (branch deploy) | **next.videojs.org** | Pre-release docs (may include unreleased APIs) | +| `main` (branch deploy) | **main.videojs.org** | Pre-release docs (may include unreleased APIs) | **On release:** The CD workflow (`.github/workflows/cd.yml`) publishes packages to npm, then force-pushes `main`'s HEAD to `site/v10`. This keeps the production docs in sync with the latest release. @@ -29,7 +29,7 @@ git push origin site/v10 The next release force-pushes `main` to `site/v10`, which already includes the cherry-picked commit (since it originated on `main`). All fixes must land on `main` first — the `site/v10` branch has branch protection that restricts direct pushes to the CD bot. -**Branch deploys (next.videojs.org)** serve `X-Robots-Tag: noindex` headers to prevent search engines from indexing pre-release docs. +**Branch deploys (main.videojs.org)** serve `X-Robots-Tag: noindex` headers to prevent search engines from indexing pre-release docs. They also render a top banner (`src/components/PrereleaseBanner.astro`) that links back to the stable site. The banner is gated by `isPrereleaseSite(Astro.site)` from `src/consts.ts` — change `PRERELEASE_URL` there if the pre-release hostname moves. ## Commands diff --git a/site/README.md b/site/README.md index c5e73cf0..dcdfe788 100644 --- a/site/README.md +++ b/site/README.md @@ -73,7 +73,7 @@ The site deploys via Netlify from two branches: | Branch | Deploys to | Content | | :--- | :--- | :--- | | `site/v10` | **videojs.org** | Stable docs matching the latest release | -| `main` | **next.videojs.org** | Pre-release docs (may include unreleased APIs) | +| `main` | **main.videojs.org** | Pre-release docs (may include unreleased APIs) | On each release, the CD workflow force-pushes `main` to `site/v10`, keeping production docs in sync with published packages. diff --git a/site/astro.config.mjs b/site/astro.config.mjs index 2a476f7c..f076c02d 100644 --- a/site/astro.config.mjs +++ b/site/astro.config.mjs @@ -24,6 +24,7 @@ import tsx from 'shiki/langs/tsx.mjs'; import yaml from 'shiki/langs/yaml.mjs'; import svgr from 'vite-plugin-svgr'; import llmsMarkdown from './integrations/llms-markdown'; +import { PRERELEASE_URL, PRODUCTION_URL } from './src/consts.ts'; import rehypePrepareCodeBlocks from './src/utils/rehypePrepareCodeBlocks'; import remarkConditionalHeadings from './src/utils/remarkConditionalHeadings'; import { remarkReadingTime } from './src/utils/remarkReadingTime.mjs'; @@ -32,18 +33,21 @@ import shikiTransformMetadata from './src/utils/shikiTransformMetadata'; // Netlify sets CONTEXT and BRANCH for each deploy. We use them to determine // the correct site URL: -// - production (site/v10 branch) → https://videojs.org -// - branch-deploy (main branch) → https://next.videojs.org +// - production (site/v10 branch) → PRODUCTION_URL (videojs.org) +// - branch-deploy (main branch) → PRERELEASE_URL (main.videojs.org) // - deploy-preview (PR branches) → DEPLOY_PRIME_URL (Netlify subdomain) // +// Hostnames are sourced from src/consts.ts so there is a single place to +// update if the pre-release or production host ever moves. +// // For URLs that must always point to production regardless of deploy context // (e.g. canonical, JSON-LD), use PRODUCTION_URL from src/consts.ts instead. const SITE_URL = process.env.CONTEXT === 'production' - ? 'https://videojs.org' + ? PRODUCTION_URL.origin : process.env.BRANCH === 'main' - ? 'https://next.videojs.org' - : process.env.DEPLOY_PRIME_URL || 'https://videojs.org'; + ? PRERELEASE_URL.origin + : process.env.DEPLOY_PRIME_URL || PRODUCTION_URL.origin; // https://astro.build/config export default defineConfig({ diff --git a/site/sentry.server.config.ts b/site/sentry.server.config.ts index 92f477b7..bbc87d52 100644 --- a/site/sentry.server.config.ts +++ b/site/sentry.server.config.ts @@ -7,7 +7,7 @@ import * as Sentry from '@sentry/astro'; // (e.g. a broken PR) out of Sentry — we only want live request failures. const isLambdaRuntime = Boolean(process.env.AWS_LAMBDA_FUNCTION_NAME); -// Alert for production (videojs.org) and branch-deploy (next.videojs.org) only. +// Alert for production (videojs.org) and branch-deploy (main.videojs.org) only. // Deploy-preview errors are the PR author's to triage before merge. const context = import.meta.env.CONTEXT; const isAlertingContext = context === 'production' || context === 'branch-deploy'; diff --git a/site/src/components/PrereleaseBanner.astro b/site/src/components/PrereleaseBanner.astro new file mode 100644 index 00000000..b72db7e0 --- /dev/null +++ b/site/src/components/PrereleaseBanner.astro @@ -0,0 +1,32 @@ +--- +import { isPrereleaseSite, PRODUCTION_URL } from '@/consts'; + +// Only render on the pre-release host. Evaluated at build time, so the markup +// is omitted entirely from production and deploy-preview builds. +const showBanner = isPrereleaseSite(Astro.site); +--- + +{ + showBanner && ( +
+ You’re viewing pre-release docs.{" "} + + Visit videojs.org + {" "} + for the latest stable version. +
+