From 2b5654a6c8a0402136ec1e222822f38931a88d1f Mon Sep 17 00:00:00 2001 From: Benson Cho <100653148+bcho892@users.noreply.github.com> Date: Sun, 21 Jul 2024 14:57:39 +1200 Subject: [PATCH] add robots and sitemap generation (#665) * add robots and sitemap generation * add link for icon * fix typo in tailwind config --- .../workflows/deploy-client-production.yml | 1 + client/environment.d.ts | 4 +-- client/next.config.mjs | 3 -- client/src/app/layout.tsx | 1 + client/src/app/robots.ts | 22 ++++++++++++++ client/src/app/sitemap.ts | 29 +++++++++++++++++++ client/tailwind.config.ts | 10 +++---- 7 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 client/src/app/robots.ts create mode 100644 client/src/app/sitemap.ts diff --git a/.github/workflows/deploy-client-production.yml b/.github/workflows/deploy-client-production.yml index 01ed79d8c..3675c9cee 100644 --- a/.github/workflows/deploy-client-production.yml +++ b/.github/workflows/deploy-client-production.yml @@ -19,6 +19,7 @@ env: NEXT_PUBLIC_SANITY_PROJECT_ID: ${{secrets.PROD_SANITY_PROJECT_ID}} NEXT_PUBLIC_SANITY_DATASET: production NEXT_CONFIG_ENV: production + FRONTEND_BASE_URL: ${{secrets.PROD_FRONTEND_URL}} jobs: Deploy-Client: diff --git a/client/environment.d.ts b/client/environment.d.ts index b4c72ded3..f09613b58 100644 --- a/client/environment.d.ts +++ b/client/environment.d.ts @@ -21,12 +21,12 @@ declare global { readonly NEXT_PUBLIC_ENV_STRIPE_PUBLISHABLE_KEY: string /** Used for deployments */ readonly NEXT_CONFIG_ENV?: "production" | "staging" - /** What all paths should be prefixed with */ - readonly DEPLOYMENT_BASE_PATH?: string /** The project to fetch content from in sanity */ readonly NEXT_PUBLIC_SANITY_PROJECT_ID: string /** The dataset to use - for local use this should only be set to staging */ readonly NEXT_PUBLIC_SANITY_DATASET: "production" | "staging" + /** Used for `sitemap.xml` and `robots.txt` generation, should **NOT** include a trailing slash */ + readonly FRONTEND_BASE_URL: string } } } diff --git a/client/next.config.mjs b/client/next.config.mjs index 930a25b28..e8d0756a8 100644 --- a/client/next.config.mjs +++ b/client/next.config.mjs @@ -1,12 +1,9 @@ const env = process.env.NEXT_CONFIG_ENV || "development" -const customBasePath = process.env.DEPLOYMENT_BASE_PATH - const generateStatic = env === "staging" || env === "production" /** @type {import('next').NextConfig} */ const nextConfig = { - basePath: customBasePath, webpack(config) { config.module.rules.push({ test: /\.svg$/i, diff --git a/client/src/app/layout.tsx b/client/src/app/layout.tsx index ae8bd9a39..a585cb911 100644 --- a/client/src/app/layout.tsx +++ b/client/src/app/layout.tsx @@ -18,6 +18,7 @@ export default function RootLayout({ }>) { return ( +