add Head template

This commit is contained in:
Kentai Radiquum 2025-01-30 00:32:34 +05:00
parent 168baad986
commit 236246a83f
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
5 changed files with 213 additions and 33 deletions

View file

@ -0,0 +1,40 @@
export default function head(props: {
title: string;
description: string;
image: string;
path: string;
url: string;
environment: "prod" | "dev";
preload?: string[];
dns?: string[];
}) {
const mimetype = `image/${
props.image.split(".")[props.image.split(".").length - 1]
}`;
return (
<head>
<meta charSet="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{props.title}</title>
<link rel="icon" type="image/ico" href="/favicon.ico" />
<meta property="og:title" content={props.title} />
<meta property="og:description" content={props.description} />
<meta property="og:type" content="website" />
<meta property="og:image" content={props.image} />
<meta property="og:image:type" content={mimetype} />
<meta property="og:image:alt" content="" />
<link href="/static/tailwind.css" rel="stylesheet" />
<meta property="og:url" content={`${props.url}${props.path}`} />
{props.preload ? props.preload.map((item) => <link key={`preload_${item}`} rel="preload" href={item} as="fetch"></link>) : ""}
{props.dns ? props.dns.map((item) => <link key={`dns_${item}`} rel="dns-prefetch" href={item} />) : ""}
{/* <meta property="og:logo" content="<%- baseUrl %><%= path %>/static/images/logo-1x.png" /> */}
{props.environment == "dev" ? (
<script src="./static/dev/hotreload.js"></script>
) : (
""
)}
{/* <script src="./static/functions.js"></script> */}
</head>
);
}

View file

@ -0,0 +1,26 @@
import Head from "./Components/Head";
export default function Index(props: {
environment: "prod" | "dev";
title: string;
head: {
description: string;
image: string;
path: string;
url: string;
preload?: string[];
dns?: string[];
};
}) {
return (
<html>
<Head
environment={props.environment}
title={props.title}
{...props.head}
/>
<body>
nothing yet . . .
</body>
</html>
);
}