119 lines
3.6 KiB
TypeScript
119 lines
3.6 KiB
TypeScript
import type { Metadata } from "next";
|
|
import Link from "next/link";
|
|
import { notFound } from "next/navigation";
|
|
import { CheckList, PageHead, PageShell, Sub } from "@/components/page/Blocks";
|
|
import JsonLd from "@/components/JsonLd";
|
|
import { OG_COMMON, breadcrumbSchema, serviceSchema, faqSchema } from "@/lib/seo";
|
|
import { PHONE_DISPLAY, PHONE_E164 } from "@/lib/site";
|
|
import { leistungBySlug, leistungen } from "@/lib/leistungen";
|
|
|
|
export const dynamicParams = false;
|
|
|
|
export function generateStaticParams() {
|
|
return leistungen.map((l) => ({ slug: l.slug }));
|
|
}
|
|
|
|
export async function generateMetadata({
|
|
params,
|
|
}: {
|
|
params: Promise<{ slug: string }>;
|
|
}): Promise<Metadata> {
|
|
const { slug } = await params;
|
|
const l = leistungBySlug(slug);
|
|
if (!l) return {};
|
|
const path = `/leistungen/${l.slug}`;
|
|
return {
|
|
title: l.metaTitle,
|
|
description: l.metaDescription,
|
|
alternates: { canonical: path },
|
|
openGraph: { ...OG_COMMON, title: l.metaTitle, description: l.metaDescription, url: path },
|
|
};
|
|
}
|
|
|
|
export default async function LeistungPage({ params }: { params: Promise<{ slug: string }> }) {
|
|
const { slug } = await params;
|
|
const l = leistungBySlug(slug);
|
|
if (!l) notFound();
|
|
const path = `/leistungen/${l.slug}`;
|
|
|
|
return (
|
|
<PageShell>
|
|
<JsonLd
|
|
data={breadcrumbSchema([
|
|
{ name: "Services", path: "/services" },
|
|
{ name: l.name, path },
|
|
])}
|
|
/>
|
|
<JsonLd data={serviceSchema({ name: l.h1, description: l.metaDescription, path })} />
|
|
{l.faq.length > 0 && <JsonLd data={faqSchema(l.faq)} />}
|
|
<PageHead
|
|
crumbs={[{ label: "Services", href: "/services" }, { label: l.name }]}
|
|
title={l.h1}
|
|
lead={l.intro}
|
|
actions={
|
|
<>
|
|
<Link href="/#contact" className="btn-primary btn-lg">
|
|
Jetzt anfragen
|
|
</Link>
|
|
<a href={`tel:${PHONE_E164}`} className="btn-secondary btn-lg">
|
|
{PHONE_DISPLAY}
|
|
</a>
|
|
</>
|
|
}
|
|
/>
|
|
|
|
<Sub title="Das umfasst unsere Leistung">
|
|
<div style={{ maxWidth: "70ch" }}>
|
|
<CheckList items={l.leistungen} />
|
|
</div>
|
|
</Sub>
|
|
|
|
<Sub>
|
|
<div className="prose">
|
|
{l.abschnitte.map((a) => (
|
|
<section key={a.h2} style={{ display: "grid", gap: "var(--space-sm)" }}>
|
|
<h2>{a.h2}</h2>
|
|
{a.text.map((t) => (
|
|
<p key={t}>{t}</p>
|
|
))}
|
|
</section>
|
|
))}
|
|
</div>
|
|
</Sub>
|
|
|
|
<Sub band title="Häufige Fragen">
|
|
<div className="faq">
|
|
{l.faq.map((f) => (
|
|
<details key={f.frage}>
|
|
<summary>{f.frage}</summary>
|
|
<p>{f.antwort}</p>
|
|
</details>
|
|
))}
|
|
</div>
|
|
</Sub>
|
|
|
|
<Sub>
|
|
<div style={{ display: "grid", gap: "var(--space-2xl)" }}>
|
|
<div className="consult">
|
|
<div style={{ display: "grid", gap: "var(--space-xs)" }}>
|
|
<h2 style={{ fontSize: "var(--text-2xl)" }}>Sprechen wir darüber</h2>
|
|
<p>Schildern Sie uns kurz Ihr Anliegen. Wir melden uns persönlich bei Ihnen.</p>
|
|
</div>
|
|
<Link href="/#contact" className="btn-primary btn-lg">
|
|
Anfrage senden
|
|
</Link>
|
|
</div>
|
|
|
|
<nav aria-label="Weitere Seiten" className="related">
|
|
{l.verwandt.map((v) => (
|
|
<Link key={v.href} href={v.href} className="text-link">
|
|
{v.label}
|
|
</Link>
|
|
))}
|
|
</nav>
|
|
</div>
|
|
</Sub>
|
|
</PageShell>
|
|
);
|
|
}
|