mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-03-13 02:48:56 +01:00
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import React from "react";
|
|
import Helmet from "react-helmet";
|
|
|
|
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;
|
|
noIndex?: boolean;
|
|
}
|
|
|
|
const Layout: React.FC<Props> = ({
|
|
children,
|
|
title,
|
|
description,
|
|
socialImage = "",
|
|
noIndex = false,
|
|
}: Props) => {
|
|
const { author, url } = useSiteMetadata();
|
|
const metaImage = socialImage || author.photo;
|
|
const metaImageUrl = url + metaImage;
|
|
|
|
return (
|
|
<div className={styles.layout}>
|
|
<Helmet>
|
|
<html lang="en" />
|
|
<title>{title}</title>
|
|
<meta name="description" content={description} />
|
|
<meta property="og:site_name" content={title} />
|
|
<meta property="og:image" content={metaImageUrl} />
|
|
<meta name="twitter:card" content="summary" />
|
|
<meta name="twitter:title" content={title} />
|
|
<meta name="twitter:description" content={description} />
|
|
<meta name="twitter:image" content={metaImageUrl} />
|
|
{noIndex && <meta name="robots" content="noindex" />}
|
|
</Helmet>
|
|
{children}
|
|
<CookieBar />
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Layout;
|