Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { CustomMDX } from "../../../../content/mdx";
import { sections } from "../../../../content/sections";
import { getComparePages } from "../../../../content/utils";
import { JsonLd } from "../../../../lib/metadata/json-ld";
import { getPageMetadata } from "../../../../lib/metadata/shared-metadata";
import {
createJsonLDGraph,
getJsonLDBlogPosting,
getJsonLDFAQPage,
getJsonLDHowTo,
getJsonLDOrganization,
getJsonLDSectionBreadcrumb,
getJsonLDWebPage,
} from "../../../../lib/metadata/structured-data";
import { ContentPagination } from "../../content-pagination";
export const dynamicParams = false;
export async function generateMetadata({
params,
}: {
params: Promise<{ slug: string }>;
}): Promise<Metadata | undefined> {
const { slug } = await params;
const post = getComparePages().find((post) => post.slug === slug);
if (!post) {
return;
}
const metadata = getPageMetadata(post, "compare");
return metadata;
}
export async function generateStaticParams() {
const posts = getComparePages();
return posts.map((post) => ({
slug: post.slug,
}));
}
export default async function Blog({
params,
}: {
params: Promise<{ slug: string }>;
}) {
const { slug } = await params;
const posts = getComparePages().sort(
(a, b) =>
b.metadata.publishedAt.getTime() - a.metadata.publishedAt.getTime(),
);
const postIndex = posts.findIndex((post) => post.slug === slug);
const post = posts[postIndex];
const previousPost = posts[postIndex - 1];
const nextPost = posts[postIndex + 1];
if (!post) {
notFound();
}
const jsonLDGraph = createJsonLDGraph([
getJsonLDOrganization(),
getJsonLDWebPage(post),
getJsonLDBlogPosting(post, "compare"),
getJsonLDSectionBreadcrumb(sections.compare, {
label: post.metadata.title,
path: post.href,
}),
getJsonLDHowTo(post),
getJsonLDFAQPage(post),
]);
return (
<section className="prose dark:prose-invert max-w-none">
<JsonLd graph={jsonLDGraph} />
<h1>{post.metadata.hero ?? post.metadata.title}</h1>
<p className="text-lg">{post.metadata.description}</p>
<CustomMDX source={post.content} />
<ContentPagination prev={previousPost} next={nextPost} />
</section>
);
}