2022-08-28 20:12:09 +02:00
|
|
|
import Head from 'next/head';
|
2024-02-20 11:07:31 +01:00
|
|
|
import { useRouter } from 'next/router';
|
2022-08-28 20:12:09 +02:00
|
|
|
|
|
|
|
const TITLE_SUFFIX = 'Iconoir | Free Icons';
|
|
|
|
|
|
|
|
export interface SEOProps {
|
|
|
|
title?: string;
|
2023-11-19 10:02:47 +01:00
|
|
|
description?: string;
|
2022-08-28 20:12:09 +02:00
|
|
|
}
|
2023-11-19 10:25:34 +01:00
|
|
|
export function SEO({ title, description }: SEOProps) {
|
2024-02-20 11:07:31 +01:00
|
|
|
const { asPath } = useRouter();
|
2022-08-28 20:12:09 +02:00
|
|
|
const pageTitle = title ? `${title} | ${TITLE_SUFFIX}` : TITLE_SUFFIX;
|
2023-11-19 10:02:47 +01:00
|
|
|
const pageDescription = description;
|
2023-10-29 00:33:17 +02:00
|
|
|
|
2024-02-20 11:07:31 +01:00
|
|
|
const pathWithoutQuery = asPath.split(/[?#]/)[0];
|
2024-02-20 11:22:56 +01:00
|
|
|
const canonicalUrl = `https://iconoir.com${
|
|
|
|
pathWithoutQuery !== '/' ? pathWithoutQuery : ''
|
|
|
|
}`;
|
2024-02-20 11:07:31 +01:00
|
|
|
|
2022-08-28 20:12:09 +02:00
|
|
|
return (
|
|
|
|
<Head>
|
|
|
|
<title>{pageTitle}</title>
|
2024-02-20 11:07:31 +01:00
|
|
|
<link rel="canonical" href={canonicalUrl} />
|
2023-11-19 10:25:34 +01:00
|
|
|
<meta name="description" content={pageDescription} />
|
2022-08-28 20:12:09 +02:00
|
|
|
<link rel="icon" href="/favicon.ico" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
|
|
|
|
<meta property="og:title" content={pageTitle} />
|
|
|
|
<meta property="og:site_name" content="Iconoir" />
|
|
|
|
<meta property="og:type" content="website" />
|
|
|
|
<meta property="og:url" content="https://iconoir.com" />
|
|
|
|
<meta
|
|
|
|
property="og:image"
|
2023-10-21 10:00:05 +02:00
|
|
|
content="https://iconoir.com/iconoir-brand.png"
|
2022-08-28 20:12:09 +02:00
|
|
|
/>
|
2023-11-19 10:25:34 +01:00
|
|
|
<meta property="og:description" content={pageDescription} />
|
2022-08-28 20:12:09 +02:00
|
|
|
<meta property="og:image:width" content="1270" />
|
|
|
|
<meta property="og:image:height" content="760" />
|
|
|
|
|
|
|
|
<meta name="twitter:title" content={pageTitle} />
|
|
|
|
<meta name="twitter:domain" content="iconoir.com" />
|
|
|
|
<meta name="twitter:url" content="https://iconoir.com" />
|
|
|
|
<meta
|
|
|
|
name="twitter:image"
|
2023-10-21 10:00:05 +02:00
|
|
|
content="https://iconoir.com/iconoir-brand.png"
|
2022-08-28 20:12:09 +02:00
|
|
|
/>
|
|
|
|
<meta
|
|
|
|
name="twitter:image:secure_url"
|
2023-10-21 10:00:05 +02:00
|
|
|
content="https://iconoir.com/iconoir-brand.png"
|
2022-08-28 20:12:09 +02:00
|
|
|
/>
|
|
|
|
<meta
|
|
|
|
name="twitter:image:alt"
|
2023-03-07 22:37:53 +01:00
|
|
|
content="The biggest open source icon library with tons of free icons."
|
2022-08-28 20:12:09 +02:00
|
|
|
/>
|
2023-11-19 10:25:34 +01:00
|
|
|
<meta name="twitter:description" content={pageDescription} />
|
2022-08-28 20:12:09 +02:00
|
|
|
<meta name="twitter:card" content="summary_large_image" />
|
|
|
|
</Head>
|
|
|
|
);
|
|
|
|
}
|