From 1b293895f2f9ead9d25257aef975f824011c4ef4 Mon Sep 17 00:00:00 2001 From: nuno-aac Date: Mon, 18 Sep 2023 16:22:02 +0100 Subject: [PATCH] Fix twitter share image --- .../src/pages/posts/@category/@slug/index.page.server.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/workspaces/website/src/pages/posts/@category/@slug/index.page.server.tsx b/workspaces/website/src/pages/posts/@category/@slug/index.page.server.tsx index 62736901650..a3ec7fb961b 100644 --- a/workspaces/website/src/pages/posts/@category/@slug/index.page.server.tsx +++ b/workspaces/website/src/pages/posts/@category/@slug/index.page.server.tsx @@ -25,6 +25,11 @@ export async function onBeforeRender(pageContext: PageContextServer) { }, }; + const baseUrl = import.meta.env.VITE_GIT_BRANCH_NAME === "production" + ? "https://www.starknet.io" + : import.meta.env.VITE_SITE_URL ?? "http://localhost:3000"; + + return { pageContext: { ...defaultPageContext, @@ -32,7 +37,7 @@ export async function onBeforeRender(pageContext: PageContextServer) { documentProps: { title: post.title, description: post.short_desc, - image: `${import.meta.env.VITE_SITE_URL}${post.image}`, + image: `${baseUrl}${post.image}`, } satisfies DocumentProps, }, };