diff --git a/.github/workflows/build-static.yml b/.github/workflows/build-emedded.yml similarity index 78% rename from .github/workflows/build-static.yml rename to .github/workflows/build-emedded.yml index a80de5f..18bc111 100644 --- a/.github/workflows/build-static.yml +++ b/.github/workflows/build-emedded.yml @@ -1,4 +1,4 @@ -name: Build static site package +name: Build embedded docsite env: NODE_VERSION: 20 @@ -8,8 +8,8 @@ on: branches: [main] jobs: - build-static: - name: Build static site + build-embedded: + name: Build embedded site runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -22,9 +22,9 @@ jobs: run: | corepack enable yarn install - - name: Build static site + - name: Build embedded site run: DISABLE_ALGOLIA=1 yarn build - - name: Upload static site artifact + - name: Upload embedded site artifact uses: actions/upload-artifact@v4 with: name: static-site diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 00d04c4..021b815 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -1,5 +1,7 @@ import type { Config } from "@docusaurus/types"; +const baseUrl = process.env.EMBEDDED ? "/docsite/" : "/"; + const config: Config = { title: "Wave Terminal Documentation", tagline: "Level Up Your Terminal With Graphical Widgets", @@ -9,7 +11,7 @@ const config: Config = { url: "https://docs.waveterm.dev/", // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' - baseUrl: "/", + baseUrl, // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. @@ -49,7 +51,7 @@ const config: Config = { ], themes: [ ["classic", { customCss: "src/css/custom.css" }], - !process.env.DISABLE_ALGOLIA ? "@docusaurus/theme-search-algolia" : undefined, + !process.env.EMBEDDED ? "@docusaurus/theme-search-algolia" : undefined, ].filter((v) => v), themeConfig: { docs: { @@ -77,19 +79,23 @@ const config: Config = { docId: "index", label: "Docs", }, - { - href: "https://discord.gg/zUeP2aAjaP", - position: "right", - className: "header-link-custom custom-icon-discord", - "aria-label": "Discord invite", - }, - { - href: "https://github.com/wavetermdev/waveterm", - position: "right", - className: "header-link-custom custom-icon-github", - "aria-label": "GitHub repository", - }, - ], + !process.env.EMBEDDED + ? [ + { + href: "https://discord.gg/zUeP2aAjaP", + position: "right", + className: "header-link-custom custom-icon-discord", + "aria-label": "Discord invite", + }, + { + href: "https://github.com/wavetermdev/waveterm", + position: "right", + className: "header-link-custom custom-icon-github", + "aria-label": "GitHub repository", + }, + ] + : [], + ].flat(), }, metadata: [ { @@ -131,7 +137,7 @@ const config: Config = { as: "font", type: "font/woff2", "data-next-font": "size-adjust", - href: "/fontawesome/webfonts/fa-sharp-regular-400.woff2", + href: `${baseUrl}fontawesome/webfonts/fa-sharp-regular-400.woff2`, }, }, { @@ -140,11 +146,11 @@ const config: Config = { rel: "sitemap", type: "application/xml", title: "Sitemap", - href: "/sitemap.xml", + href: `${baseUrl}sitemap.xml`, }, }, ], - stylesheets: ["/fontawesome/css/fontawesome.min.css", "/fontawesome/css/sharp-regular.min.css"], + stylesheets: [`${baseUrl}fontawesome/css/fontawesome.min.css`, `${baseUrl}fontawesome/css/sharp-regular.min.css`], staticDirectories: ["static"], }; diff --git a/package.json b/package.json index 5b8a27f..ac97bcb 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "docusaurus": "docusaurus", "start": "docusaurus start", "build": "USE_SIMPLE_CSS_MINIFIER=true docusaurus build", - "build-local": "DISABLE_ALGOLIA=true run build", + "build-local": "EMBEDDED=true run build", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", "clear": "docusaurus clear",