first commit
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
---
|
||||
import "../styles/global.css";
|
||||
import Header from "../components/Header.astro";
|
||||
import Footer from "../components/Footer.astro";
|
||||
import { COMPANY_NAME, PRIMARY_DOMAIN, sections, resolveSection } from "../lib/sections";
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
description: string;
|
||||
image?: string;
|
||||
}
|
||||
|
||||
const { title, description, image } = Astro.props;
|
||||
|
||||
const pathname = Astro.url.pathname;
|
||||
// Host only matters to resolve the bare "/" root; every other path is
|
||||
// resolved from the pathname alone, so skip touching request headers there
|
||||
// (they aren't available on statically prerendered pages).
|
||||
const hostname = pathname === "/" ? Astro.request.headers.get("host") ?? Astro.url.hostname : "";
|
||||
const section = resolveSection(pathname, hostname);
|
||||
|
||||
// "/" mirrors different content per host; canonicalize it to the matching
|
||||
// stable section path so both domains consolidate onto one indexable URL.
|
||||
const canonicalPath = pathname === "/" ? sections[section].homeHref : pathname;
|
||||
const canonicalUrl = new URL(canonicalPath, PRIMARY_DOMAIN).toString();
|
||||
---
|
||||
|
||||
<html lang="de" data-section={section}>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<title>{title} · {COMPANY_NAME}</title>
|
||||
<meta name="description" content={description} />
|
||||
<link rel="canonical" href={canonicalUrl} />
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content={title} />
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:url" content={canonicalUrl} />
|
||||
{image && <meta property="og:image" content={image} />}
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
</head>
|
||||
<body class="min-h-screen flex flex-col bg-white text-brand-body antialiased">
|
||||
<Header section={section} />
|
||||
<main class="flex-1">
|
||||
<slot />
|
||||
</main>
|
||||
<Footer section={section} />
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user