From f83b5b4e7b794ed6af073992c2e0a5eb0fa54eb1 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:36:35 +0000 Subject: [PATCH] Refactor: Improve Open Graph meta tags --- index.html | 2 ++ src/hooks/useOpenGraph.ts | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/index.html b/index.html index 8dcb33a1..cadd1092 100644 --- a/index.html +++ b/index.html @@ -28,6 +28,7 @@ + @@ -35,6 +36,7 @@ + diff --git a/src/hooks/useOpenGraph.ts b/src/hooks/useOpenGraph.ts index e9a2eb9e..dfe06677 100644 --- a/src/hooks/useOpenGraph.ts +++ b/src/hooks/useOpenGraph.ts @@ -40,6 +40,9 @@ export function useOpenGraph({ finalImageUrl = window.location.origin + finalImageUrl; } + // Update document title + document.title = title.includes('ThrillWiki') ? title : `${title} | ThrillWiki`; + // Update or create meta tags updateMetaTag('og:title', title); updateMetaTag('og:description', description || 'Explore theme parks and roller coasters worldwide with ThrillWiki'); @@ -51,16 +54,20 @@ export function useOpenGraph({ updateMetaTag('twitter:title', title, 'name'); updateMetaTag('twitter:description', description || 'Explore theme parks and roller coasters worldwide with ThrillWiki', 'name'); updateMetaTag('twitter:image', finalImageUrl, 'name'); + updateMetaTag('twitter:url', currentUrl, 'name'); return () => { + document.title = 'ThrillWiki - Theme Park & Roller Coaster Database'; updateMetaTag('og:title', 'ThrillWiki - Theme Park & Roller Coaster Database'); updateMetaTag('og:description', 'Explore theme parks and roller coasters worldwide with ThrillWiki - the comprehensive database for enthusiasts'); updateMetaTag('og:image', 'https://cdn.thrillwiki.com/images/4af6a0c6-4450-497d-772f-08da62274100/original'); updateMetaTag('og:type', 'website'); + updateMetaTag('og:url', 'https://www.thrillwiki.com/'); updateMetaTag('twitter:title', 'ThrillWiki - Theme Park & Roller Coaster Database', 'name'); updateMetaTag('twitter:description', 'Explore theme parks and roller coasters worldwide with ThrillWiki - the comprehensive database for enthusiasts', 'name'); updateMetaTag('twitter:image', 'https://cdn.thrillwiki.com/images/4af6a0c6-4450-497d-772f-08da62274100/original', 'name'); + updateMetaTag('twitter:url', 'https://www.thrillwiki.com/', 'name'); }; }, [title, description, imageUrl, imageId, type, currentUrl, enabled]); }