2024-06-24 17:44:08 +00:00
|
|
|
import { SITE_DEFAULT_META, SITE_TITLE } from "../constants.js";
|
2024-06-24 16:55:39 +00:00
|
|
|
import { JSX } from "preact/jsx-runtime";
|
2024-06-24 17:44:08 +00:00
|
|
|
import { asset } from "../assets.js";
|
2024-06-24 16:55:39 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
title?: string;
|
|
|
|
meta?: { [name: string]: string };
|
2024-06-24 17:34:33 +00:00
|
|
|
Content: () => JSX.Element;
|
|
|
|
};
|
2024-06-24 16:55:39 +00:00
|
|
|
|
2024-06-24 17:34:33 +00:00
|
|
|
export default ({ title, meta, Content }: Props) => {
|
|
|
|
const metaTags = Object.entries(Object.assign({}, SITE_DEFAULT_META, meta || {})).map(
|
2024-06-24 16:55:39 +00:00
|
|
|
([name, value]) => <meta name={name} value={value} />,
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
<title
|
|
|
|
dangerouslySetInnerHTML={{
|
2024-06-24 17:34:33 +00:00
|
|
|
__html: [title, SITE_TITLE].filter(Boolean).join(" – "),
|
2024-06-24 16:55:39 +00:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
{metaTags}
|
2024-06-24 17:31:11 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href={asset("index.css")} />
|
2024-06-24 16:55:39 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2024-06-24 17:34:33 +00:00
|
|
|
<div class="main">
|
|
|
|
<Content />
|
|
|
|
</div>
|
2024-06-24 16:55:39 +00:00
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
);
|
|
|
|
};
|