![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.ca/public_html/src/components/ |
import Head from 'next/head';
interface OpenGraphMetaProps {
title: string;
description: string;
url: string;
image?: string;
type?: 'website' | 'article' | 'profile';
siteName?: string;
author?: string;
publishedTime?: string;
modifiedTime?: string;
section?: string;
tags?: string[];
twitterCard?: 'summary' | 'summary_large_image' | 'app' | 'player';
twitterCreator?: string;
twitterSite?: string;
}
const OpenGraphMeta: React.FC<OpenGraphMetaProps> = ({
title,
description,
url,
image,
type = 'website',
siteName = 'Liberté Même en Prison',
author,
publishedTime,
modifiedTime,
section,
tags = [],
twitterCard = 'summary_large_image',
twitterCreator,
twitterSite = '@LiberteMemeEnPrison'
}) => {
const fullUrl = url.startsWith('http') ? url : `${process.env.NEXT_PUBLIC_APP_URL || 'https://localhost:3000'}${url}`;
const fullImage = image?.startsWith('http') ? image : `${process.env.NEXT_PUBLIC_APP_URL || 'https://localhost:3000'}${image}`;
return (
<Head>
{/* Basic Meta Tags */}
<title>{title}</title>
<meta name="description" content={description} />
<meta name="keywords" content={tags.join(', ')} />
{/* Open Graph Meta Tags */}
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:url" content={fullUrl} />
<meta property="og:type" content={type} />
<meta property="og:site_name" content={siteName} />
<meta property="og:locale" content="en_US" />
{/* Open Graph Image */}
{fullImage && (
<>
<meta property="og:image" content={fullImage} />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content={title} />
</>
)}
{/* Article Specific Meta Tags */}
{type === 'article' && (
<>
{author && <meta property="article:author" content={author} />}
{publishedTime && <meta property="article:published_time" content={publishedTime} />}
{modifiedTime && <meta property="article:modified_time" content={modifiedTime} />}
{section && <meta property="article:section" content={section} />}
{tags.map((tag, index) => (
<meta key={index} property="article:tag" content={tag} />
))}
</>
)}
{/* Twitter Card Meta Tags */}
<meta name="twitter:card" content={twitterCard} />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
{fullImage && <meta name="twitter:image" content={fullImage} />}
{twitterCreator && <meta name="twitter:creator" content={twitterCreator} />}
{twitterSite && <meta name="twitter:site" content={twitterSite} />}
{/* Additional Meta Tags */}
<meta name="robots" content="index, follow" />
<meta name="author" content={author || siteName} />
{/* Canonical URL */}
<link rel="canonical" href={fullUrl} />
</Head>
);
};
export default OpenGraphMeta;