sendou.ink/components/common/SEO.tsx
Kalle (Sendou) f7cc9ee7d0 seo test v3
2020-12-14 11:26:33 +02:00

48 lines
901 B
TypeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { NextSeo } from "next-seo";
import { useRouter } from "next/router";
interface Props {
title: string;
description: string;
// 1200x628
imageSrc: string;
appendTitle?: boolean;
}
const SEO: React.FC<Props> = ({
title,
description,
imageSrc,
appendTitle = true,
}) => {
const router = useRouter();
const fullTitle = appendTitle ? `${title} | sendou.ink` : title;
const url = "https://sendou.ink" + router.pathname;
return (
<NextSeo
title={fullTitle}
description={description}
openGraph={{
url,
title,
description,
images: [
{
url: imageSrc,
width: 1200,
height: 628,
},
],
site_name: "sendou.ink",
}}
twitter={{
site: "@sendouink",
cardType: "summary_large_image",
}}
/>
);
};
export default SEO;