Skip to content

Commit

Permalink
Fix some SEO details
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchernchong committed Dec 7, 2024
1 parent 1cfae28 commit 819176e
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 48 deletions.
20 changes: 11 additions & 9 deletions app/(default)/cars/fuel-types/[fuelType]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,17 @@ export const generateMetadata = async (props: {

const formattedFuelType = deslugify(fuelType);
const title = `${formattedFuelType} Cars in Singapore`;
const description = `Explore registration trends and statistics for ${formattedFuelType} cars in Singapore.`;
const pageUrl = `/cars/fuel-types/${fuelType}`;
const description = `${formattedFuelType} cars registrations by month. Explore registration trends, statistics and distribution by fuel type for the month in Singapore.`;
const canonical = `/cars/fuel-types/${fuelType}`;

return {
metadataBase: new URL(SITE_URL),
title,
description,
openGraph: {
title,
description,
images: "/opengraph-image.png",
url: pageUrl,
images: `${SITE_URL}/opengraph-image.png`,
url: canonical,
siteName: SITE_TITLE,
locale: "en_SG",
type: "website",
Expand All @@ -53,12 +52,12 @@ export const generateMetadata = async (props: {
card: "summary_large_image",
title,
description,
images: "/opengraph-image.png",
images: `${SITE_URL}/twitter-image.png`,
site: "@sgcarstrends",
creator: "@sgcarstrends",
},
alternates: {
canonical: pageUrl,
canonical,
},
};
};
Expand Down Expand Up @@ -91,11 +90,14 @@ const CarsByFuelTypePage = async (props: {
const filteredCars = mergeCarsByMake(cars);

const formattedFuelType = deslugify(fuelType);

const title = `${formattedFuelType} Cars in Singapore`;
const description = `${formattedFuelType} cars overview. Explore registration trends, statistics and distribution by fuel type for the month in Singapore.`;
const structuredData: WithContext<WebPage> = {
"@context": "https://schema.org",
"@type": "WebPage",
name: `${formattedFuelType} Car in Singapore`,
description: `Explore registration trends and statistics for ${formattedFuelType} cars in Singapore.`,
name: title,
description,
url: `${SITE_URL}/cars/fuel-types/${fuelType}`,
publisher: {
"@type": "Organization",
Expand Down
23 changes: 13 additions & 10 deletions app/(default)/cars/makes/[make]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,29 @@ export const generateMetadata = async (props: {
const { make } = params;

const formattedMake = deslugify(make).toUpperCase();
const description = `Historical trends and monthly breakdown of ${formattedMake} cars by fuel and vehicle types in Singapore.`;
const title = `${formattedMake} Cars Overview`;
const description = `${formattedMake} cars overview. Historical car registrations trends and monthly breakdown by fuel and vehicle types in Singapore.`;
// const images = `/api/og?title=Historical Trend&make=${make}`;
const canonicalUrl = `/cars/makes/${make}`;
const canonical = `/cars/makes/${make}`;

return {
metadataBase: new URL(SITE_URL),
title: formattedMake,
title,
description,
openGraph: {
images: "/opengraph-image.png",
url: canonicalUrl,
images: `${SITE_URL}/opengraph-image.png`,
url: canonical,
siteName: SITE_TITLE,
locale: "en_SG",
type: "website",
},
twitter: {
card: "summary_large_image",
images: "/opengraph-image.png",
images: `${SITE_URL}/twitter-image.png`,
site: "@sgcarstrends",
creator: "@sgcarstrends",
},
alternates: {
canonical: canonicalUrl,
canonical,
},
};
};
Expand Down Expand Up @@ -81,11 +81,14 @@ const CarMakePage = async (props: { params: Params }) => {
const filteredCars = mergeCarData(cars);

const formattedMake = deslugify(make).toUpperCase();

const title = `${formattedMake} Cars Overview`;
const description = `${formattedMake} cars overview. Historical car registrations trends and monthly breakdown by fuel and vehicle types in Singapore.`;
const structuredData: WithContext<WebPage> = {
"@context": "https://schema.org",
"@type": "WebPage",
name: `${formattedMake} Car Registrations in Singapore`,
description: `Historical trends and monthly breakdown of ${formattedMake} cars by fuel and vehicle types in Singapore.`,
name: title,
description,
url: `${SITE_URL}/cars/makes/${make}`,
publisher: {
"@type": "Organization",
Expand Down
20 changes: 11 additions & 9 deletions app/(default)/cars/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,30 @@ export const generateMetadata = async (props: {

const formattedMonth = formatDateToMonthYear(month);

const title = `${formattedMonth} Car Registrations in Singapore`;
const title = "Car Registrations in Singapore";
const description = `Discover ${formattedMonth} car registrations in Singapore. See detailed stats by fuel type, vehicle type, and top brands.`;
const pageUrl = `/cars`;
const canonical = `/cars`;

// const images = `/api/og?title=Car Registrations for ${formattedMonth}`;

return {
metadataBase: new URL(SITE_URL),
title,
description,
openGraph: {
images: "/opengraph-image.png",
url: pageUrl,
images: `${SITE_URL}/opengraph-image.png`,
url: canonical,
siteName: SITE_TITLE,
locale: "en_SG",
type: "website",
},
twitter: {
card: "summary_large_image",
images: "/opengraph-image.png",
images: `${SITE_URL}/twitter-image.png`,
site: "@sgcarstrends",
creator: "@sgcarstrends",
},
alternates: {
canonical: pageUrl,
canonical,
},
};
};
Expand Down Expand Up @@ -126,11 +125,14 @@ const CarsPage = async (props: { searchParams: SearchParams }) => {
findTopEntry(numberByVehicleType);

const formattedMonth = formatDateToMonthYear(month);

const title = "Car Registrations in Singapore";
const description = `Discover ${formattedMonth} car registrations in Singapore. See detailed stats by fuel type, vehicle type, and top brands.`;
const structuredData: WithContext<WebPage> = {
"@context": "https://schema.org",
"@type": "WebPage",
name: `${formattedMonth} Car Registrations in Singapore`,
description: `Discover ${formattedMonth} car registrations in Singapore. See detailed stats by fuel type, vehicle type, and top brands.`,
name: title,
description,
url: `${SITE_URL}/cars`,
publisher: {
"@type": "Organization",
Expand Down
24 changes: 14 additions & 10 deletions app/(default)/cars/vehicle-types/[vehicleType]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,29 @@ export const generateMetadata = async (props: {
const { vehicleType } = params;

const formattedVehicleType = deslugify(vehicleType);
const title = `${formattedVehicleType} Cars in Singapore`;
const description = `${formattedVehicleType} cars registrations by month. Explore registration trends, statistics and distribution by vehicle type for the month in Singapore.`;
// const images = `/api/og?title=Historical Trend&type=${vehicleType}`;
const canonicalUrl = `/cars/vehicle-types/${vehicleType}`;
const canonical = `/cars/vehicle-types/${vehicleType}`;

return {
metadataBase: new URL(SITE_URL),
title: `${formattedVehicleType} Cars in Singapore`,
description: `Explore registration trends and statistics for ${formattedVehicleType} cars in Singapore.`,
title,
description,
openGraph: {
images: "/opengraph-image.png",
url: canonicalUrl,
images: `${SITE_URL}/opengraph-image.png`,
url: canonical,
siteName: SITE_TITLE,
locale: "en_SG",
type: "website",
},
twitter: {
card: "summary_large_image",
images: "/opengraph-image.png",
images: `${SITE_URL}/twitter-image.png`,
site: "@sgcarstrends",
creator: "@sgcarstrends",
},
alternates: {
canonical: canonicalUrl,
canonical,
},
};
};
Expand Down Expand Up @@ -92,11 +93,14 @@ const CarsByVehicleTypePage = async (props: {
const filteredCars = mergeCarsByMake(cars);

const formattedVehicleType = deslugify(vehicleType);

const title = `${formattedVehicleType} Cars in Singapore`;
const description = `${formattedVehicleType} cars registrations by month. Explore registration trends, statistics and distribution by vehicle type for the month in Singapore.`;
const structuredData: WithContext<WebPage> = {
"@context": "https://schema.org",
"@type": "WebPage",
name: `${formattedVehicleType} Cars in Singapore`,
description: `Explore registration trends and statistics for ${formattedVehicleType} cars in Singapore.`,
name: title,
description,
url: `${SITE_URL}/cars/vehicle-types/${vehicleType}`,
publisher: {
"@type": "Organization",
Expand Down
13 changes: 6 additions & 7 deletions app/(default)/coe/(prices)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,30 @@ type SearchParams = Promise<{ [key: string]: string | string[] | undefined }>;

const title = "COE Result";
const description =
"Explore historical trends and bidding results for COE in Singapore.";
"Explore historical Certificate of Entitlement (COE) price trends and bidding results for car registrations in Singapore.";

export const generateMetadata = async (): Promise<Metadata> => {
const pageUrl = "/coe";
const canonical = "/coe";
// const images = "/api/og?title=COE Result";

return {
metadataBase: new URL(SITE_URL),
title,
description,
openGraph: {
images: "/opengraph-image.png",
url: pageUrl,
images: `${SITE_URL}/opengraph-image.png`,
url: canonical,
siteName: SITE_TITLE,
locale: "en_SG",
type: "website",
},
twitter: {
card: "summary_large_image",
images: "/opengraph-image.png",
images: `${SITE_URL}/twitter-image.png`,
site: "@sgcarstrends",
creator: "@sgcarstrends",
},
alternates: {
canonical: pageUrl,
canonical,
},
};
};
Expand Down
9 changes: 6 additions & 3 deletions app/(default)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ const url = new URL(SITE_URL);

export const metadata: Metadata = {
metadataBase: url,
title,
title: {
template: `%s - ${SITE_TITLE}`,
default: SITE_TITLE,
},
description,
robots: { index: true, follow: true },
openGraph: {
title,
description,
images: "/opengraph-image.png",
images: `${SITE_URL}/opengraph-image.png`,
url,
siteName: title,
locale: "en_SG",
Expand All @@ -36,7 +39,7 @@ export const metadata: Metadata = {
card: "summary_large_image",
title,
description,
images: "/opengraph-image.png",
images: `${SITE_URL}/twitter-image.png`,
site: "@sgcarstrends",
creator: "@sgcarstrends",
},
Expand Down

0 comments on commit 819176e

Please sign in to comment.