From b82ce11f9345d6847b702ac6ae9c216805265c3f Mon Sep 17 00:00:00 2001 From: "yongen.loong" Date: Tue, 16 Jul 2024 19:56:36 +0800 Subject: [PATCH] fix: undefined in client component --- .env.example | 2 +- .github/workflows/github-pages.yml | 2 +- app/sitemap.ts | 4 +++- components/Header.tsx | 2 +- components/footer.tsx | 2 +- components/search.tsx | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index aba8d67..fff2497 100644 --- a/.env.example +++ b/.env.example @@ -3,4 +3,4 @@ APP_SECRET= SPACE_ID= COOKIE_PASSWORD= COOKIE_NAME= -SITE_URL= \ No newline at end of file +NEXT_PUBLIC_SITE_URL= \ No newline at end of file diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index fb9f073..0d147f9 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -80,7 +80,7 @@ jobs: echo APP_ID=${{ secrets.APP_ID }} >> .env echo APP_SECRET=${{ secrets.APP_SECRET }} >> .env echo SPACE_ID=${{ secrets.SPACE_ID }} >> .env - echo SITE_URL=${{ vars.SITE_URL }} >> .env + echo NEXT_PUBLIC_SITE_URL=${{ vars.SITE_URL }} >> .env - name: Build with Next.js run: ${{ steps.detect-package-manager.outputs.runner }} next build - name: Upload artifact diff --git a/app/sitemap.ts b/app/sitemap.ts index 81fc32a..a973579 100644 --- a/app/sitemap.ts +++ b/app/sitemap.ts @@ -17,7 +17,9 @@ export default async function sitemap(): Promise { if (nodes) { for (const node of nodes) { map.push({ - url: `${process.env.SITE_URL}${await getPath(node.node_token)}`, + url: `${process.env.NEXT_PUBLIC_SITE_URL}${await getPath( + node.node_token + )}`, lastModified: new Date(Number(node.obj_edit_time) * 1000), changeFrequency: "weekly", priority: 0.5, diff --git a/components/Header.tsx b/components/Header.tsx index 170d4c0..acb4970 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -52,7 +52,7 @@ export default function Header({ menu }: Props) {
logo
logo { (async () => { - const res = await fetch(`${process.env.SITE_URL}/api/search`); + const res = await fetch(`${process.env.NEXT_PUBLIC_SITE_URL}/api/search`); const data = await res.json(); const config = searchConfigSchema.parse(data);