diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..f88a1d85 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,18 @@ +# Read the Docs configuration for the documentation app (apps/documentation). +# See https://docs.readthedocs.io/en/stable/config-file/v2.html +# +# Pull request previews and per-branch builds are project settings on Read +# the Docs ("Build pull requests" and an "activate" automation rule for +# branches), not part of this file. +version: 2 + +build: + os: ubuntu-24.04 + tools: + # Same major version as the docs image (Dockerfile) once #466 is done + nodejs: "24" + commands: + - npm ci --no-audit --no-fund + - npx turbo run build --filter=ecc-docs... + - mkdir -p $READTHEDOCS_OUTPUT + - cp -r apps/documentation/out $READTHEDOCS_OUTPUT/html diff --git a/apps/documentation/components/common/Footer.tsx b/apps/documentation/components/common/Footer.tsx index bb6ba67e..14c57857 100644 --- a/apps/documentation/components/common/Footer.tsx +++ b/apps/documentation/components/common/Footer.tsx @@ -1,4 +1,5 @@ import Image from 'next/image'; +import { withBasePath } from '@/utils/basePath'; function Footer() { return ( @@ -6,17 +7,17 @@ function Footer() {
- Elixir Cloud & AAI + Elixir Cloud & AAI Cloud SDK Cloud SDK Elixir Elixir
@@ -29,7 +31,7 @@ export default function Hero() {
{ - window.location.href = '/docs/introduction'; + router.push('/docs/introduction'); }} variant='default' className='part:bg-sky-600 part:hover:bg-sky-500 part:text-white' diff --git a/apps/documentation/components/home/ServicesShowcase.tsx b/apps/documentation/components/home/ServicesShowcase.tsx index 0f528343..4a7a594b 100644 --- a/apps/documentation/components/home/ServicesShowcase.tsx +++ b/apps/documentation/components/home/ServicesShowcase.tsx @@ -1,5 +1,6 @@ 'use client'; import { useState } from 'react'; +import Link from 'next/link'; import { useTheme } from 'next-themes'; import RunsPreview from '@/components/packages/wes/RunsPreview'; import RunCreatePreview from '@/components/packages/wes/RunCreatePreview'; @@ -134,9 +135,9 @@ export default function ServicesShowcase() {
- + View More Components - +
diff --git a/apps/documentation/next.config.js b/apps/documentation/next.config.js index b739e9b9..381bb0f9 100644 --- a/apps/documentation/next.config.js +++ b/apps/documentation/next.config.js @@ -7,6 +7,13 @@ const withNextra = require('nextra')({ // eslint-disable-next-line @typescript-eslint/no-var-requires const withLitSSR = require('@lit-labs/nextjs')(); +// Read the Docs serves each version under a subpath (e.g. /en/latest/ or +// /en//), given by READTHEDOCS_CANONICAL_URL at build time. +// Outside Read the Docs, the variable is unset and nothing changes. +const rtdUrl = process.env.READTHEDOCS_CANONICAL_URL; +const basePath = rtdUrl ? new URL(rtdUrl).pathname.replace(/\/$/, '') : ''; +const rtdConfig = rtdUrl ? { basePath, trailingSlash: true } : {}; + /** @type {import('next').NextConfig} */ module.exports = withLitSSR({ ...withNextra(), @@ -14,4 +21,8 @@ module.exports = withLitSSR({ images: { unoptimized: true, }, + // Always set, so that a stray NEXT_PUBLIC_BASE_PATH in the environment + // can't prefix assets without a matching basePath. + env: { NEXT_PUBLIC_BASE_PATH: basePath }, + ...rtdConfig, }); diff --git a/apps/documentation/pages/docs/introduction.mdx b/apps/documentation/pages/docs/introduction.mdx index b23097b3..b017c2fe 100644 --- a/apps/documentation/pages/docs/introduction.mdx +++ b/apps/documentation/pages/docs/introduction.mdx @@ -1,3 +1,4 @@ +import Link from 'next/link'; import { Callout } from 'nextra/components'; import { Steps } from 'nextra/components'; import { @@ -34,9 +35,9 @@ While we are continuously expanding the ECC suite, the current version includes
- + - + @@ -55,9 +56,9 @@ While we are continuously expanding the ECC suite, the current version includes
- + - + @@ -76,9 +77,9 @@ While we are continuously expanding the ECC suite, the current version includes
- + - + @@ -97,9 +98,9 @@ While we are continuously expanding the ECC suite, the current version includes
- + - + @@ -118,9 +119,9 @@ While we are continuously expanding the ECC suite, the current version includes
- + - + diff --git a/apps/documentation/theme.config.tsx b/apps/documentation/theme.config.tsx index c6ab6b17..9f82843e 100644 --- a/apps/documentation/theme.config.tsx +++ b/apps/documentation/theme.config.tsx @@ -1,6 +1,7 @@ import { useRouter } from 'next/router' import { DocsThemeConfig } from 'nextra-theme-docs'; import Image from 'next/image'; +import { withBasePath } from './utils/basePath'; import { RiSlackFill, RiGithubFill } from '@remixicon/react'; import Footer from './components/common/Footer'; @@ -8,7 +9,7 @@ import Footer from './components/common/Footer'; const config: DocsThemeConfig = { logo: (
- Logo + Logo ELIXIR Cloud Components
), @@ -26,6 +27,15 @@ const config: DocsThemeConfig = { component: