From c8f7d760049f64fa02aafe64c2070ff55321d5f8 Mon Sep 17 00:00:00 2001 From: Ru Chern Chong Date: Thu, 16 Nov 2023 21:01:35 +0800 Subject: [PATCH] Update metadata --- app/layout.tsx | 32 ++++++++++++++++-- config/index.ts | 7 +++- .../og-image.png | Bin 3 files changed, 35 insertions(+), 4 deletions(-) rename app/opengraph-image.png => public/og-image.png (100%) diff --git a/app/layout.tsx b/app/layout.tsx index 6e6bc6e..e86de5d 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -3,14 +3,40 @@ import type { Metadata } from "next"; import Script from "next/script"; import { Inter } from "next/font/google"; import classNames from "classnames"; +import { BASE_URL } from "@/config"; import "./globals.css"; const inter = Inter({ subsets: ["latin"] }); +const title = `Singapore EV Trends`; +const description = `Stay ahead of the shift to Electric Vehicle (EV) in Singapore with the latest Singapore EV trends. Data provided by Land Transport Authority (LTA)`; + export const metadata: Metadata = { - title: "Singapore EV Trends", - description: - "Stay ahead of the shift to Electric Vehicle (EV) in Singapore with the latest Singapore EV trends. Data provided by Land Transport Authority (LTA)", + metadataBase: new URL(BASE_URL), + title: { + default: title, + template: `%s | ${title}`, + }, + description, + robots: { index: true, follow: true }, + openGraph: { + title, + description, + url: BASE_URL, + siteName: title, + images: "/og-image.png", + locale: "en_SG", + type: "website", + }, + twitter: { + card: "summary_large_image", + title, + description, + creator: "@ruchernchong", + images: "/og-image.png", + }, + authors: [{ name: "Ru Chern", url: "https://ruchern.xyz" }], + creator: "Ru Chern", }; const RootLayout = ({ children }: { children: React.ReactNode }) => { diff --git a/config/index.ts b/config/index.ts index 5eb7788..ebb1d4a 100644 --- a/config/index.ts +++ b/config/index.ts @@ -1,4 +1,9 @@ -export const BASE_URL: string = `https://singapore-ev-trends.ruchern.xyz`; +export const isProd = process.env.NODE_ENV === "production"; + +export const BASE_URL: string = !isProd + ? `http://localhost:3000` + : `https://singapore-ev-trends.ruchern.xyz`; + export const API_URL: string = `https://api.singapore-ev-trends.ruchern.xyz`; export enum FUEL_TYPE { diff --git a/app/opengraph-image.png b/public/og-image.png similarity index 100% rename from app/opengraph-image.png rename to public/og-image.png