env driven base url for docs
This commit is contained in:
parent
65c07b1fec
commit
d2eaeb3e34
@ -22,6 +22,20 @@ Build output:
|
||||
|
||||
- `docs-site/build`
|
||||
|
||||
## Configuration
|
||||
|
||||
Set these environment variables for deploys:
|
||||
|
||||
- `DOCS_SITE_URL`: Public origin for canonical/sitemap URLs.
|
||||
Example: `https://jobops.dakheera47.com`
|
||||
- `DOCS_BASE_URL`: Route prefix where docs are hosted.
|
||||
Example: `/docs/`
|
||||
|
||||
Defaults (local development):
|
||||
|
||||
- `DOCS_SITE_URL=http://localhost:3006`
|
||||
- `DOCS_BASE_URL=/docs/`
|
||||
|
||||
## Versioning
|
||||
|
||||
Cut a docs version tied to a release tag:
|
||||
|
||||
@ -2,6 +2,15 @@ import type * as Preset from "@docusaurus/preset-classic";
|
||||
import type { Config } from "@docusaurus/types";
|
||||
import { themes as prismThemes } from "prism-react-renderer";
|
||||
|
||||
const siteUrl = process.env.DOCS_SITE_URL ?? "http://localhost:3006";
|
||||
const configuredBaseUrl = process.env.DOCS_BASE_URL ?? "/docs/";
|
||||
const normalizedBaseUrl = configuredBaseUrl.startsWith("/")
|
||||
? configuredBaseUrl
|
||||
: `/${configuredBaseUrl}`;
|
||||
const siteBaseUrl = normalizedBaseUrl.endsWith("/")
|
||||
? normalizedBaseUrl
|
||||
: `${normalizedBaseUrl}/`;
|
||||
|
||||
const config: Config = {
|
||||
title: "JobOps Documentation",
|
||||
tagline: "Self-hosted job search automation docs",
|
||||
@ -9,8 +18,8 @@ const config: Config = {
|
||||
future: {
|
||||
v4: true,
|
||||
},
|
||||
url: "http://localhost:3005",
|
||||
baseUrl: "/docs/",
|
||||
url: siteUrl,
|
||||
baseUrl: siteBaseUrl,
|
||||
onBrokenLinks: "throw",
|
||||
markdown: {
|
||||
hooks: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user