summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJay V <[email protected]>2025-07-07 16:31:10 -0400
committerJay V <[email protected]>2025-07-07 16:31:15 -0400
commitfacd851b119f3570a00769a2cb8755e5d245fdff (patch)
treea0f44730148cb2d60493772372ff3bbd27f31519
parentc51de945a5620d77ccb25652c732d259035a8cf7 (diff)
downloadopencode-facd851b119f3570a00769a2cb8755e5d245fdff.tar.gz
opencode-facd851b119f3570a00769a2cb8755e5d245fdff.zip
docs: dynamic domain
-rw-r--r--infra/app.ts1
-rw-r--r--packages/web/astro.config.mjs7
-rw-r--r--packages/web/config.mjs2
-rw-r--r--packages/web/src/components/Head.astro2
4 files changed, 7 insertions, 5 deletions
diff --git a/infra/app.ts b/infra/app.ts
index f585748ae..caaea0e9d 100644
--- a/infra/app.ts
+++ b/infra/app.ts
@@ -39,6 +39,7 @@ new sst.cloudflare.x.Astro("Web", {
domain,
path: "packages/web",
environment: {
+ // For astro config
SST_STAGE: $app.stage,
VITE_API_URL: api.url,
},
diff --git a/packages/web/astro.config.mjs b/packages/web/astro.config.mjs
index 742d52951..538784acf 100644
--- a/packages/web/astro.config.mjs
+++ b/packages/web/astro.config.mjs
@@ -9,12 +9,13 @@ import { rehypeHeadingIds } from "@astrojs/markdown-remark"
import rehypeAutolinkHeadings from "rehype-autolink-headings"
const github = "https://github.com/sst/opencode"
-
-console.log("stage", process.env.SST_STAGE)
+const stage = process.env.SST_STAGE || "dev"
// https://astro.build/config
export default defineConfig({
- site: config.url,
+ site: stage === "production"
+ ? `https://${config.domain}`
+ : `https://${stage}.${config.domain}`,
output: "server",
adapter: cloudflare({
imageService: "passthrough",
diff --git a/packages/web/config.mjs b/packages/web/config.mjs
index f4c2fe994..f0ae3cb61 100644
--- a/packages/web/config.mjs
+++ b/packages/web/config.mjs
@@ -1,5 +1,5 @@
export default {
- url: "https://opencode.ai",
+ domain: "opencode.ai",
socialCard: "https://social-cards.sst.dev",
github: "https://github.com/sst/opencode",
discord: "https://discord.gg/opencode",
diff --git a/packages/web/src/components/Head.astro b/packages/web/src/components/Head.astro
index f6166f58f..9ebf734cd 100644
--- a/packages/web/src/components/Head.astro
+++ b/packages/web/src/components/Head.astro
@@ -13,7 +13,7 @@ const {
const isDocs = slug.startsWith("docs")
let encodedTitle = '';
-let ogImage = `${config.url}/social-share.png`;
+let ogImage = `https://${config.domain}/social-share.png`;
let truncatedDesc = '';
if (isDocs) {