diff --git a/.forgejo/workflows/documentation.yml b/.forgejo/workflows/documentation.yml index 32827a412..57cfb3de7 100644 --- a/.forgejo/workflows/documentation.yml +++ b/.forgejo/workflows/documentation.yml @@ -49,6 +49,8 @@ jobs: run: npm ci - name: Build Rspress documentation + env: + SITE_PATH: ${{ github.ref != 'refs/heads/main' && format('/pr/{0}/', '${{ forgejo.event.number }}') || '/' }} run: npm run docs:build - name: Install Wrangler diff --git a/package-lock.json b/package-lock.json index 7802c4951..f8ff7b797 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "devDependencies": { "@rspress/core": "^2.0.0", "@rspress/plugin-client-redirects": "^2.0.0", - "@rspress/plugin-sitemap": "^2.0.0", + "@types/node": "^26.6.6", "typescript": "^7.0.0" } }, @@ -230,9 +230,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -247,9 +244,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -264,9 +258,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -281,9 +272,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -298,9 +286,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -315,9 +300,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -332,9 +314,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -349,9 +328,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -524,19 +500,6 @@ "@rspress/core": "^2.1.0-beta.2" } }, - "node_modules/@rspress/plugin-sitemap": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@rspress/plugin-sitemap/-/plugin-sitemap-2.1.4.tgz", - "integrity": "sha512-TObDTXgBKFAHEWEth47aehQSYtFfpIkqM4w14a0hUbPLkbu2AZ2cKnMzFTKK+W6I/3LN54scvfGYTL5CPQsDXw==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "peerDependencies": { - "@rspress/core": "^2.1.0-beta.2" - } - }, "node_modules/@rspress/shared": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@rspress/shared/-/shared-2.1.4.tgz", @@ -770,6 +733,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/node": { + "version": "26.6.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.6.tgz", + "integrity": "sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~8.9.0" + } + }, "node_modules/@types/react": { "version": "19.3.0", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", @@ -3842,6 +3815,13 @@ "@typescript/typescript-win32-x64": "7.0.2" } }, + "node_modules/undici-types": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz", + "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==", + "dev": true, + "license": "MIT" + }, "node_modules/unhead": { "version": "2.1.17", "resolved": "https://registry.npmjs.org/unhead/-/unhead-2.1.17.tgz", diff --git a/package.json b/package.json index 6ae3569a6..aa2e0db2c 100644 --- a/package.json +++ b/package.json @@ -20,11 +20,11 @@ "keywords": [], "author": "", "license": "ISC", - "type": "commonjs", + "type": "module", "devDependencies": { "@rspress/core": "^2.0.0", "@rspress/plugin-client-redirects": "^2.0.0", - "@rspress/plugin-sitemap": "^2.0.0", + "@types/node": "^26.6.6", "typescript": "^7.0.0" } } diff --git a/rspress.config.ts b/rspress.config.ts index de38b38eb..3739a13fe 100644 --- a/rspress.config.ts +++ b/rspress.config.ts @@ -1,10 +1,13 @@ import { defineConfig } from '@rspress/core'; -import { pluginSitemap } from '@rspress/plugin-sitemap'; import { pluginClientRedirects } from '@rspress/plugin-client-redirects'; +const sitePath: string = process.env.SITE_PATH ?? '/'; + export default defineConfig({ root: 'docs', title: 'Continuwuity', + siteOrigin: sitePath != "/" ? "https://preview.continuwuity.org" : "https://continuwuity.org", + base: sitePath, description: 'A community-driven Matrix homeserver', icon: '/assets/logo.svg', logo: { @@ -75,14 +78,10 @@ export default defineConfig({ lastUpdated: true, enableContentAnimation: true, enableAppearanceAnimation: false, - footer: { - }, + footer: {}, }, - plugins: [pluginSitemap({ - siteUrl: 'https://continuwuity.org', // TODO: Set automatically in build pipeline - }), - pluginClientRedirects({ + plugins: [pluginClientRedirects({ redirects: [{ from: '^/config_reference$', to: '/reference/config' @@ -105,8 +104,8 @@ export default defineConfig({ from: "^/source(|_code)$", to: "https://forgejo.ellis.link/continuwuation/continuwuity", }, { - from: "^/(CONTRIBUTING.md|contributing)$", - to: "/development/contributing" + from: "^/(CONTRIBUTING.md|contributing)$", + to: "/development/contributing" } ] })],