35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import "./globals.css";
|
|
import type { Metadata } from "next";
|
|
import Header from "@/components/Header";
|
|
import Footer from "@/components/Footer";
|
|
import Analytics from "@/components/Analytics";
|
|
import { site } from "@/lib/site";
|
|
|
|
export const metadata: Metadata = {
|
|
metadataBase: new URL(site.url),
|
|
title: { default: site.name, template: `%s · ${site.name}` },
|
|
description: site.description,
|
|
alternates: { canonical: "/" },
|
|
};
|
|
|
|
const PLAUSIBLE_HOST = process.env.NEXT_PUBLIC_PLAUSIBLE_HOST || "https://plausible.io";
|
|
const PLAUSIBLE_DOMAIN = process.env.NEXT_PUBLIC_PLAUSIBLE_DOMAIN || "";
|
|
|
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
const enablePlausible = Boolean(PLAUSIBLE_DOMAIN);
|
|
return (
|
|
<html lang="en">
|
|
<head>
|
|
{enablePlausible && (<><link rel="preconnect" href={PLAUSIBLE_HOST} crossOrigin="" /><link rel="dns-prefetch" href={PLAUSIBLE_HOST} /></>)}
|
|
</head>
|
|
<body>
|
|
<a href="#main" className="skip-link">Skip to content</a>
|
|
<Header />
|
|
<main id="main" className="min-h-[60vh]">{children}</main>
|
|
<Footer />
|
|
<Analytics host={PLAUSIBLE_HOST} domain={PLAUSIBLE_DOMAIN} />
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|