Jay V 8 месяцев назад
Родитель
Сommit
f436a50125
2 измененных файлов с 16 добавлено и 14 удалено
  1. 7 6
      packages/web/astro.config.mjs
  2. 9 8
      packages/web/src/components/Header.astro

+ 7 - 6
packages/web/astro.config.mjs

@@ -4,10 +4,15 @@ import starlight from "@astrojs/starlight"
 import solidJs from "@astrojs/solid-js"
 import cloudflare from "@astrojs/cloudflare"
 import theme from "toolbeam-docs-theme"
+import config from "./config.mjs"
 import { rehypeHeadingIds } from "@astrojs/markdown-remark"
 import rehypeAutolinkHeadings from "rehype-autolink-headings"
 
 const github = "https://github.com/sst/opencode"
+const headerLinks = [
+  { name: "Docs", url: "/docs/" },
+  { name: "GitHub", url: github },
+]
 
 // https://astro.build/config
 export default defineConfig({
@@ -30,7 +35,7 @@ export default defineConfig({
       title: "opencode",
       expressiveCode: { themes: ["github-light", "github-dark"] },
       social: [
-        { icon: "github", label: "GitHub", href: github },
+        { icon: "github", label: "GitHub", href: config.github },
       ],
       editLink: {
         baseUrl: `${github}/edit/master/www/`,
@@ -59,11 +64,7 @@ export default defineConfig({
       },
       plugins: [
         theme({
-          // Optionally, add your own header links
-          headerLinks: [
-            { name: "Home", url: "/" },
-            { name: "Docs", url: "/docs/" },
-          ],
+          headerLinks: config.headerLinks,
         }),
       ],
     }),

+ 9 - 8
packages/web/src/components/Header.astro

@@ -1,5 +1,6 @@
 ---
-import config from 'virtual:starlight/user-config';
+import config from '../../config.mjs';
+import astroConfig from 'virtual:starlight/user-config';
 import { Icon } from '@astrojs/starlight/components';
 import { HeaderLinks } from 'toolbeam-docs-theme/components';
 import Default from 'toolbeam-docs-theme/overrides/Header.astro';
@@ -8,8 +9,8 @@ import SiteTitle from '@astrojs/starlight/components/SiteTitle.astro';
 
 const path = Astro.url.pathname;
 
-const links = config.social || [];
-const { headerLinks } = globalThis.toolbeamDocsThemeConfig ?? {};
+const links = astroConfig.social || [];
+const headerLinks = config.headerLinks;
 
 ---
 
@@ -19,11 +20,11 @@ const { headerLinks } = globalThis.toolbeamDocsThemeConfig ?? {};
 		<SiteTitle {...Astro.props} />
 	</div>
 	<div class="middle-group sl-flex">
-{
-  headerLinks?.map(({ name, url }) => (
-    <a class="links" href={url}>{name}</a>
-  ))
-}
+		{
+		  headerLinks?.map(({ name, url }) => (
+		    <a class="links" href={url}>{name}</a>
+		  ))
+		}
 	</div>
 	<div class="sl-hidden md:sl-flex right-group">
 		{