Skip to content

Commit

Permalink
Merge pull request #175 from sgcarstrends/hotfix/site-title
Browse files Browse the repository at this point in the history
Remove site name from title tags
  • Loading branch information
ruchernchong authored Dec 2, 2024
2 parents 3123b96 + 22a5733 commit cad3f71
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 40 deletions.
19 changes: 10 additions & 9 deletions app/cars/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ export const generateMetadata = async (props: {
month = latestMonth.cars;
}

const formattedDate = formatDateToMonthYear(month);
const formattedMonth = formatDateToMonthYear(month);

const title = "Car Registrations";
const description = `Breakdown of cars registered in ${formattedDate} by fuel types and vehicle types.`;
const title = `${formattedMonth} 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 images = `/api/og?title=Car Registrations for ${formattedDate}`;
// const images = `/api/og?title=Car Registrations for ${formattedMonth}`;

return {
title,
Expand Down Expand Up @@ -131,7 +131,7 @@ const CarsPage = async (props: { searchParams: SearchParams }) => {
"@context": "https://schema.org",
"@type": "WebPage",
name: `${formattedMonth} Car Registrations in Singapore`,
description: `Breakdown of the cars registered in ${formattedMonth} by fuel type and vehicle type.`,
description: `Discover ${formattedMonth} car registrations in Singapore. See detailed stats by fuel type, vehicle type, and top brands.`,
url: `${SITE_URL}/cars`,
publisher: {
"@type": "Organization",
Expand All @@ -144,11 +144,12 @@ const CarsPage = async (props: { searchParams: SearchParams }) => {
<>
<StructuredData data={structuredData} />
<div className="flex flex-col gap-4">
<div className="grid grid-cols-1 gap-2 lg:grid-cols-2">
<div className="flex items-end gap-2">
<Typography.H1>Car Registrations</Typography.H1>
<div className="flex flex-col justify-between gap-2 md:flex-row md:items-center">
<div className="space-y-2">
<Typography.H1 className="grow">Car Registrations</Typography.H1>
<Typography.H2>{formattedMonth} Stats</Typography.H2>
</div>
<div className="lg:justify-self-end">
<div className="shrink">
<Suspense fallback={null}>
<MonthSelector months={months} />
</Suspense>
Expand Down
4 changes: 2 additions & 2 deletions app/coe/(prices)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type { WebPage, WithContext } from "schema-dts";

type SearchParams = Promise<{ [key: string]: string | string[] | undefined }>;

const title = "COE Dashboard";
const title = "COE Result";
const description =
"Explore historical trends and bidding results for COE in Singapore.";

Expand Down Expand Up @@ -117,7 +117,7 @@ const COEPricesPage = async (props: { searchParams: SearchParams }) => {
<>
<StructuredData data={structuredData} />
<div className="flex flex-col gap-y-4">
<Typography.H1>COE Results</Typography.H1>
<Typography.H1>COE Result</Typography.H1>
<div className="grid grid-cols-1 gap-4 xl:grid-cols-12">
<div className="xl:col-span-8">
<COEPremiumChart data={data} months={months} />
Expand Down
5 changes: 1 addition & 4 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ const url = new URL(SITE_URL);

export const metadata: Metadata = {
metadataBase: url,
title: {
default: title,
template: `%s | ${title}`,
},
title,
description,
robots: { index: true, follow: true },
openGraph: {
Expand Down
48 changes: 23 additions & 25 deletions components/MonthSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,28 @@ export const MonthSelector = ({ months }: Props) => {
);

return (
<div>
<Select value={selectedMonth} onValueChange={handleValueChange}>
<SelectTrigger>
<SelectValue placeholder="Select Month" />
</SelectTrigger>
<SelectContent>
{sortedMonths.map(([year, months]) => (
<SelectGroup key={year}>
<SelectLabel>{year}</SelectLabel>
{months.slice().map((month) => {
const date = `${year}-${month}`;
return (
<SelectItem key={month} value={date}>
<div className="flex items-center">
<Calendar className="mr-2 h-4 w-4" />
{formatDateToMonthYear(date)}
</div>
</SelectItem>
);
})}
</SelectGroup>
))}
</SelectContent>
</Select>
</div>
<Select value={selectedMonth} onValueChange={handleValueChange}>
<SelectTrigger>
<SelectValue placeholder="Select Month" />
</SelectTrigger>
<SelectContent>
{sortedMonths.map(([year, months]) => (
<SelectGroup key={year}>
<SelectLabel>{year}</SelectLabel>
{months.slice().map((month) => {
const date = `${year}-${month}`;
return (
<SelectItem key={month} value={date}>
<div className="flex items-center">
<Calendar className="mr-2 h-4 w-4" />
{formatDateToMonthYear(date)}
</div>
</SelectItem>
);
})}
</SelectGroup>
))}
</SelectContent>
</Select>
);
};

0 comments on commit cad3f71

Please sign in to comment.