Skip to content

Commit

Permalink
Update URLs for consistency
Browse files Browse the repository at this point in the history
Relates to #160
  • Loading branch information
ruchernchong committed Nov 3, 2024
1 parent 2ec8910 commit abd6430
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion app/cars/brands/[brand]/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const columns: ColumnDef<Car>[] = [
header: "Vehicle Type",
cell: ({ row }) => {
const type = row.getValue("vehicle_type") as string;
return <Link href={`/vehicle-type/${type.toLowerCase()}`}>{type}</Link>;
return <Link href={`/vehicle-types/${type.toLowerCase()}`}>{type}</Link>;
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const generateMetadata = async ({
month = latestMonth.cars;
}
const images = `${SITE_URL}/api/og?type=${fuelType}&month=${month}`;
const pageUrl = `/cars/fuel-type/${fuelType}`;
const pageUrl = `/cars/fuel-types/${fuelType}`;

return {
title: capitaliseWords(fuelType),
Expand All @@ -57,10 +57,10 @@ export const generateMetadata = async ({
};

const tabItems: Record<string, string> = {
petrol: "/cars/fuel-type/petrol",
hybrid: "/cars/fuel-type/hybrid",
electric: "/cars/fuel-type/electric",
diesel: "/cars/fuel-type/diesel",
petrol: "/cars/fuel-types/petrol",
hybrid: "/cars/fuel-types/hybrid",
electric: "/cars/fuel-types/electric",
diesel: "/cars/fuel-types/diesel",
};

export const generateStaticParams = () =>
Expand Down Expand Up @@ -88,7 +88,7 @@ const CarsByFuelTypePage = async ({ params, searchParams }: Props) => {
"@type": "Dataset",
name: `${capitaliseWords(fuelType)} Car Registrations in Singapore`,
description: `Overview and registration statistics for ${fuelType} cars in Singapore by make`,
url: `${SITE_URL}/cars/fuel-type/${fuelType}`,
url: `${SITE_URL}/cars/fuel-types/${fuelType}`,
creator: {
"@type": "Organization",
name: SITE_TITLE,
Expand Down
4 changes: 2 additions & 2 deletions app/cars/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,14 @@ const CarsPage = async ({ searchParams }: Props) => {
description="Distribution of vehicles based on fuel type"
data={numberByFuelType}
total={total}
linkPrefix="fuel-type"
linkPrefix="fuel-types"
/>
<StatisticsCard
title="By Vehicle Type"
description="Distribution of vehicles based on vehicle type"
data={numberByVehicleType}
total={total}
linkPrefix="vehicle-type"
linkPrefix="vehicle-types"
/>
</div>
<div className="grid gap-4 lg:col-span-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const generateMetadata = async ({
vehicleType = decodeURIComponent(vehicleType);
const description = `${capitaliseWords(vehicleType)} historical trends`;
const images = `/api/og?title=Historical Trend&type=${vehicleType}`;
const canonicalUrl = `/cars/vehicle-type/${vehicleType}`;
const canonicalUrl = `/cars/vehicle-types/${vehicleType}`;

return {
title: capitaliseWords(vehicleType),
Expand All @@ -56,12 +56,12 @@ export const generateMetadata = async ({
};

const tabItems: Record<string, string> = {
hatchback: "/cars/vehicle-type/hatchback",
sedan: "/cars/vehicle-type/sedan",
"multi-purpose vehicle": "/cars/vehicle-type/multi-purpose vehicle",
"station-wagon": "/cars/vehicle-type/station-wagon",
"sports utility vehicle": "/cars/vehicle-type/sports utility vehicle",
"coupe/convertible": "/cars/vehicle-type/coupe%2Fconvertible",
hatchback: "/cars/vehicle-types/hatchback",
sedan: "/cars/vehicle-types/sedan",
"multi-purpose vehicle": "/cars/vehicle-types/multi-purpose vehicle",
"station-wagon": "/cars/vehicle-types/station-wagon",
"sports utility vehicle": "/cars/vehicle-types/sports utility vehicle",
"coupe/convertible": "/cars/vehicle-types/coupe%2Fconvertible",
};

export const generateStaticParams = () =>
Expand Down Expand Up @@ -89,7 +89,7 @@ const CarsByVehicleTypePage = async ({ params, searchParams }: Props) => {
"@type": "Dataset",
name: `${capitaliseWords(vehicleType)} Car Registrations in Singapore`,
description: `Overview and registration statistics for ${vehicleType} cars in Singapore by vehicle type`,
url: `${SITE_URL}/cars/vehicle-type/${vehicleType}`,
url: `${SITE_URL}/cars/vehicle-types/${vehicleType}`,
creator: {
"@type": "Organization",
name: SITE_TITLE,
Expand Down
2 changes: 1 addition & 1 deletion app/components/CarOverviewTrends.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Suspense } from "react";
import { TrendChart } from "@/app/cars/fuel-type/[fuelType]/TrendChart";
import { TrendChart } from "@/app/cars/fuel-types/[fuelType]/TrendChart";
import { DataTable } from "@/components/DataTable";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import type { Car } from "@/types";
Expand Down
24 changes: 12 additions & 12 deletions components/AppSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,59 +181,59 @@ const data: Nav = {
cars: [
{
title: "Fuel Type",
url: "/cars/fuel-type",
url: "/cars/fuel-types",
isActive: true,
items: [
{
title: "Petrol",
icon: Fuel,
url: "/cars/fuel-type/petrol",
url: "/cars/fuel-types/petrol",
},
{
title: "Hybrid",
icon: Zap,
url: "/cars/fuel-type/hybrid",
url: "/cars/fuel-types/hybrid",
},
{
title: "Electric",
icon: Battery,
url: "/cars/fuel-type/electric",
url: "/cars/fuel-types/electric",
},
{
title: "Diesel",
icon: Droplet,
url: "/cars/fuel-type/diesel",
url: "/cars/fuel-types/diesel",
},
],
},
{
title: "Vehicle Type",
url: "/cars/vehicle-type",
url: "/cars/vehicle-types",
isActive: true,
items: [
{
title: "Hatchback",
url: "/cars/vehicle-type/hatchback",
url: "/cars/vehicle-types/hatchback",
},
{
title: "Sedan",
url: "/cars/vehicle-type/sedan",
url: "/cars/vehicle-types/sedan",
},
{
title: "Multi-purpose Vehicle",
url: `/cars/vehicle-type/${encodeURIComponent("multi-purpose vehicle")}`,
url: `/cars/vehicle-types/${encodeURIComponent("multi-purpose vehicle")}`,
},
{
title: "Station-wagon",
url: "/cars/vehicle-type/station-wagon",
url: "/cars/vehicle-types/station-wagon",
},
{
title: "Sports Utility Vehicle",
url: `/cars/vehicle-type/${encodeURIComponent("sports utility vehicle")}`,
url: `/cars/vehicle-types/${encodeURIComponent("sports utility vehicle")}`,
},
{
title: "Coupe/Convertible",
url: `/cars/vehicle-type/${encodeURIComponent("coupe/convertible")}`,
url: `/cars/vehicle-types/${encodeURIComponent("coupe/convertible")}`,
},
],
},
Expand Down

0 comments on commit abd6430

Please sign in to comment.