mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-12-01 17:43:15 +00:00
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
|
|
interface HeadProps {
|
|
title?: string;
|
|
description?: string;
|
|
keywords?: string;
|
|
ogTitle?: string;
|
|
ogDescription?: string;
|
|
ogImage?: string;
|
|
twitterCard?: string;
|
|
twitterTitle?: string;
|
|
twitterDescription?: string;
|
|
children?: React.ReactNode;
|
|
}
|
|
|
|
export function Head({
|
|
title,
|
|
description,
|
|
keywords,
|
|
ogTitle,
|
|
ogDescription,
|
|
ogImage,
|
|
twitterCard,
|
|
twitterTitle,
|
|
twitterDescription,
|
|
children,
|
|
}: HeadProps) {
|
|
return (
|
|
<>
|
|
{title && <title>{title}</title>}
|
|
{description && <meta name="description" content={description} />}
|
|
{keywords && <meta name="keywords" content={keywords} />}
|
|
|
|
{/* Open Graph */}
|
|
{ogTitle && <meta property="og:title" content={ogTitle} />}
|
|
{ogDescription && (
|
|
<meta property="og:description" content={ogDescription} />
|
|
)}
|
|
{ogImage && <meta property="og:image" content={ogImage} />}
|
|
|
|
{/* Twitter */}
|
|
{twitterCard && <meta name="twitter:card" content={twitterCard} />}
|
|
{twitterTitle && <meta name="twitter:title" content={twitterTitle} />}
|
|
{twitterDescription && (
|
|
<meta name="twitter:description" content={twitterDescription} />
|
|
)}
|
|
|
|
{/* Additional elements */}
|
|
{children}
|
|
</>
|
|
);
|
|
}
|