Fix old URL generation

This commit is contained in:
gpt-engineer-app[bot]
2025-10-30 01:06:50 +00:00
parent 9f52d423f0
commit f95eaf9eb7
5 changed files with 21 additions and 26 deletions

View File

@@ -40,7 +40,7 @@ interface RideData {
async function getPageData(pathname: string, fullUrl: string): Promise<PageData> {
const normalizedPath = pathname.replace(/\/+$/, '') || '/';
const DEFAULT_FALLBACK_IMAGE = 'https://imagedelivery.net/X-2-mmiWukWxvAQQ2_o-7Q/4af6a0c6-4450-497d-772f-08da62274100/original';
const DEFAULT_FALLBACK_IMAGE = 'https://cdn.thrillwiki.com/images/4af6a0c6-4450-497d-772f-08da62274100/original';
// Individual park page: /parks/{slug}
if (normalizedPath.startsWith('/parks/') && normalizedPath.split('/').length === 3) {
@@ -63,7 +63,7 @@ async function getPageData(pathname: string, fullUrl: string): Promise<PageData>
const park = data[0] as ParkData;
const imageUrl = park.banner_image_url ||
(park.banner_image_id
? `https://imagedelivery.net/${process.env.CLOUDFLARE_ACCOUNT_HASH}/${park.banner_image_id}/original`
? `https://cdn.thrillwiki.com/images/${park.banner_image_id}/original`
: (process.env.DEFAULT_OG_IMAGE || DEFAULT_FALLBACK_IMAGE));
return {
@@ -102,7 +102,7 @@ async function getPageData(pathname: string, fullUrl: string): Promise<PageData>
const ride = data[0] as RideData;
const imageUrl = ride.banner_image_url ||
(ride.banner_image_id
? `https://imagedelivery.net/${process.env.CLOUDFLARE_ACCOUNT_HASH}/${ride.banner_image_id}/original`
? `https://cdn.thrillwiki.com/images/${ride.banner_image_id}/original`
: (process.env.DEFAULT_OG_IMAGE || DEFAULT_FALLBACK_IMAGE));
return {
@@ -124,7 +124,7 @@ async function getPageData(pathname: string, fullUrl: string): Promise<PageData>
return {
title: 'Theme Parks - ThrillWiki',
description: 'Browse theme parks and amusement parks from around the world',
image: process.env.DEFAULT_OG_IMAGE || 'https://imagedelivery.net/X-2-mmiWukWxvAQQ2_o-7Q/4af6a0c6-4450-497d-772f-08da62274100/original',
image: process.env.DEFAULT_OG_IMAGE || 'https://cdn.thrillwiki.com/images/4af6a0c6-4450-497d-772f-08da62274100/original',
url: fullUrl,
type: 'website'
};
@@ -135,7 +135,7 @@ async function getPageData(pathname: string, fullUrl: string): Promise<PageData>
return {
title: 'Roller Coasters & Rides - ThrillWiki',
description: 'Explore roller coasters and theme park rides from around the world',
image: process.env.DEFAULT_OG_IMAGE || 'https://imagedelivery.net/X-2-mmiWukWxvAQQ2_o-7Q/4af6a0c6-4450-497d-772f-08da62274100/original',
image: process.env.DEFAULT_OG_IMAGE || 'https://cdn.thrillwiki.com/images/4af6a0c6-4450-497d-772f-08da62274100/original',
url: fullUrl,
type: 'website'
};
@@ -145,7 +145,7 @@ async function getPageData(pathname: string, fullUrl: string): Promise<PageData>
return {
title: 'ThrillWiki - Theme Park & Roller Coaster Database',
description: 'Explore theme parks and roller coasters worldwide with ThrillWiki',
image: process.env.DEFAULT_OG_IMAGE || 'https://imagedelivery.net/X-2-mmiWukWxvAQQ2_o-7Q/4af6a0c6-4450-497d-772f-08da62274100/original',
image: process.env.DEFAULT_OG_IMAGE || 'https://cdn.thrillwiki.com/images/4af6a0c6-4450-497d-772f-08da62274100/original',
url: fullUrl,
type: 'website'
};