48 lines
1.3 KiB
TypeScript
Raw Normal View History

import React from "react";
import Helmet from "react-helmet";
2018-11-09 20:08:48 +03:00
2022-09-06 23:48:00 +02:00
import { CookieBar } from "../Cookiebar/CookieBar";
import * as styles from "./Layout.module.scss";
import { useSiteMetadata } from "@/hooks";
interface Props {
title: string;
description?: string;
socialImage?: string;
children: React.ReactNode;
2023-04-03 14:16:11 +02:00
noIndex?: boolean;
}
2019-05-10 02:15:43 +03:00
2023-04-03 14:16:11 +02:00
const Layout: React.FC<Props> = ({
children,
title,
description,
socialImage = "",
noIndex = false,
}: Props) => {
2019-08-25 12:29:51 +02:00
const { author, url } = useSiteMetadata();
2020-11-01 03:47:19 +03:00
const metaImage = socialImage || author.photo;
const metaImageUrl = url + metaImage;
2019-08-25 12:29:51 +02:00
return (
<div className={styles.layout}>
<Helmet>
<html lang="en" />
<title>{title}</title>
<meta name="description" content={description} />
<meta property="og:site_name" content={title} />
2019-08-25 14:50:58 +02:00
<meta property="og:image" content={metaImageUrl} />
2019-08-25 12:29:51 +02:00
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={metaImageUrl} />
2023-04-03 14:16:11 +02:00
{noIndex && <meta name="robots" content="noindex" />}
2019-08-25 12:29:51 +02:00
</Helmet>
{children}
2022-09-10 09:31:27 +02:00
<CookieBar />
2019-08-25 12:29:51 +02:00
</div>
2019-08-25 13:50:36 +02:00
);
2019-08-25 12:29:51 +02:00
};
2018-11-09 20:08:48 +03:00
export default Layout;