Add Open Graph tags

This commit is contained in:
Elias Schneider
2022-05-05 11:22:47 +02:00
parent 5409b115e7
commit 506e6b0cab
5 changed files with 26 additions and 7 deletions

View File

@@ -1,9 +1,25 @@
import Head from "next/head";
const Meta = ({ title }: { title: string }) => {
const Meta = ({
title,
description,
}: {
title: string;
description?: string;
}) => {
return (
<Head>
{/* TODO: Doesn't work because script get only executed on client side */}
<title>{title} - Pingvin Share</title>
<meta name="og:title" content={`${title} - Pingvin Share`} />
<meta
name="og:description"
content={
description ?? "An open-source and selfhosted sharing platform."
}
/>
<meta name="twitter:title" content={`${title} - Pingvin Share`} />
<meta name="twitter:description" content={description} />
</Head>
);
};