mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 14:11:13 -05:00
Refactor: Improve Open Graph meta tags
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user