Skip to content

Open-source status page, incident response and uptime monitoring

feat(external services): create og images + reword for SEO (#2165)

Colin Ozanne375e76b0ba12
diff --git a/apps/web/src/app/(landing)/status/[id]/incidents.tsx b/apps/web/src/app/(landing)/status/[id]/incidents.tsx
index 3df206802..1ec14fab3 100644
--- a/apps/web/src/app/(landing)/status/[id]/incidents.tsx
+++ b/apps/web/src/app/(landing)/status/[id]/incidents.tsx
@@ -92,59 +92,92 @@ async function fetchIncidents(
export type IncidentsProps = {
statusPageUrl: string;
+ serviceName: string;
apiConfigType?: string;
};
+function UpstreamFallback({
+ serviceName,
+ statusPageUrl,
+}: {
+ serviceName: string;
+ statusPageUrl: string;
+}) {
+ return (
+ <p className="text-muted-foreground">
+ Recent {serviceName} incident history isn't available here. Check the{" "}
+ <a
+ className="underline"
+ href={statusPageUrl}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ official {serviceName} status page
+ </a>{" "}
+ for the latest {serviceName} incidents.
+ </p>
+ );
+}
+
export async function Incidents({
statusPageUrl,
+ serviceName,
apiConfigType,
}: IncidentsProps) {
- if (apiConfigType !== "atlassian") return null;
+ if (apiConfigType !== "atlassian") {
+ return (
+ <UpstreamFallback
+ serviceName={serviceName}
+ statusPageUrl={statusPageUrl}
+ />
+ );
+ }
const incidents = await fetchIncidents(statusPageUrl);
- if (!incidents) return null;
+ if (!incidents) {
+ return (
+ <UpstreamFallback
+ serviceName={serviceName}
+ statusPageUrl={statusPageUrl}
+ />
+ );
+ }
if (incidents.length === 0) {
return (
- <section>
- <h2>Recent incidents</h2>
- <p className="text-muted-foreground">No incidents reported.</p>
- </section>
+ <p className="text-muted-foreground">
+ No {serviceName} incidents reported in the recent period.
+ </p>
);
}
return (
- <section>
- <h2>Recent incidents</h2>
- <components.Grid cols={1} className="not-prose">
- {incidents.map((inc) => {
- const started = formatTimestamp(inc.started_at ?? inc.created_at);
- const resolved = formatTimestamp(inc.resolved_at ?? null);
- const link = inc.shortlink ?? `${statusPageUrl}/incidents/${inc.id}`;
- return (
- <ContentBoxLink
- key={inc.id}
- href={link}
- className="flex flex-col gap-1"
- >
- <div className="flex items-center justify-between gap-3">
- <ContentBoxTitle className="m-0!">{inc.name}</ContentBoxTitle>
- <span
- className={`inline-flex items-center rounded-none border px-2.5 py-0.5 font-medium text-xs ${impactClass(inc.impact)}`}
- >
- {inc.impact === "none"
- ? "incident"
- : inc.impact ?? "incident"}
- </span>
- </div>
- <ContentBoxDescription className="m-0! text-sm">
- {started ? <>Started {started}</> : null}
- {started && resolved ? " · " : null}
- {resolved ? <>Resolved {resolved}</> : null}
- </ContentBoxDescription>
- </ContentBoxLink>
- );
- })}
- </components.Grid>
- </section>
+ <components.Grid cols={1} className="not-prose">
+ {incidents.map((inc) => {
+ const started = formatTimestamp(inc.started_at ?? inc.created_at);
+ const resolved = formatTimestamp(inc.resolved_at ?? null);
+ const link = inc.shortlink ?? `${statusPageUrl}/incidents/${inc.id}`;
+ return (
+ <ContentBoxLink
+ key={inc.id}
+ href={link}
+ className="flex flex-col gap-1"
+ >
+ <div className="flex items-center justify-between gap-3">
+ <ContentBoxTitle className="m-0!">{inc.name}</ContentBoxTitle>
+ <span
+ className={`inline-flex items-center rounded-none border px-2.5 py-0.5 font-medium text-xs ${impactClass(inc.impact)}`}
+ >
+ {inc.impact === "none" ? "incident" : inc.impact ?? "incident"}
+ </span>
+ </div>
+ <ContentBoxDescription className="m-0! text-sm">
+ {started ? <>Started {started}</> : null}
+ {started && resolved ? " · " : null}
+ {resolved ? <>Resolved {resolved}</> : null}
+ </ContentBoxDescription>
+ </ContentBoxLink>
+ );
+ })}
+ </components.Grid>
);
}
diff --git a/apps/web/src/app/(landing)/status/[id]/page.tsx b/apps/web/src/app/(landing)/status/[id]/page.tsx
index d85a165cf..58e414d16 100644
--- a/apps/web/src/app/(landing)/status/[id]/page.tsx
+++ b/apps/web/src/app/(landing)/status/[id]/page.tsx
@@ -16,7 +16,7 @@ import {
} from "@/lib/metadata/shared-metadata";
import { OSTinybird, safePipeData } from "@openstatus/tinybird";
-import { formatRelative, isStale } from "../utils";
+import { formatRelative, getStatusAnswer, isStale } from "../utils";
import { HistoryBars } from "./history-bars";
import { Incidents } from "./incidents";
@@ -39,9 +39,10 @@ export async function generateMetadata(args: {
const service = await cachedGetExternalServiceBySlug(id);
if (!service) return { ...defaultMetadata, title: "Not Found" };
- const title = `${service.name} Status — Is ${service.name} Down?`;
- const description = `Current status of ${service.name}. ${service.name} uptime history and recent incidents tracked by OpenStatus.`;
+ const title = `Is ${service.name} Down? ${service.name} Status & Incidents`;
+ const description = `Is ${service.name} down right now? Check the live ${service.name} status, uptime over the last ${HISTORY_DAYS} days, and recent ${service.name} incidents tracked by OpenStatus.`;
const canonicalUrl = `${BASE_URL}/status/${service.slug}`;
+ const ogImage = `${BASE_URL}/api/og/external-service?slug=${encodeURIComponent(service.slug)}`;
const indexable = service.deletedAt == null;
return {
@@ -60,14 +61,13 @@ export async function generateMetadata(args: {
title,
description,
url: canonicalUrl,
+ images: [ogImage],
},
twitter: {
...twitterMetadata,
title,
description,
- images: [
- `/api/og/status?title=${encodeURIComponent(`${service.name} Status`)}`,
- ],
+ images: [ogImage],
},
};
}
@@ -76,6 +76,7 @@ function jsonLd(args: {
serviceName: string;
serviceUrl: string;
canonicalUrl: string;
+ answer: string;
}) {
return {
"@context": "https://schema.org",
@@ -90,6 +91,19 @@ function jsonLd(args: {
url: args.canonicalUrl,
name: `${args.serviceName} Status`,
},
+ {
+ "@type": "FAQPage",
+ mainEntity: [
+ {
+ "@type": "Question",
+ name: `Is ${args.serviceName} down?`,
+ acceptedAnswer: {
+ "@type": "Answer",
+ text: args.answer,
+ },
+ },
+ ],
+ },
{
"@type": "BreadcrumbList",
itemListElement: [
@@ -146,12 +160,20 @@ export default async function Page(args: { params: Promise<RouteParams> }) {
const statusMessage = latest?.status_message ?? undefined;
const fetchedAt = latest?.last_fetched_at ?? 0;
const stale = fetchedAt > 0 && isStale(fetchedAt);
+ const hasLiveData = fetchedAt > 0 && !stale;
+ const answer = getStatusAnswer({
+ name: service.name,
+ indicator,
+ status,
+ hasLiveData,
+ });
const canonicalUrl = `${BASE_URL}/status/${service.slug}`;
const ld = jsonLd({
serviceName: service.name,
serviceUrl: service.url,
canonicalUrl,
+ answer,
});
return (
@@ -163,7 +185,11 @@ export default async function Page(args: { params: Promise<RouteParams> }) {
__html: JSON.stringify(ld).replace(/</g, "\\u003c"),
}}
/>
- <h1>{service.name} Status</h1>
+ <h1>Is {service.name} down?</h1>
+ <p>
+ {answer} Below you'll find the live {service.name} status, uptime over
+ the last {HISTORY_DAYS} days, and recent {service.name} incidents.
+ </p>
<div className="not-prose flex flex-wrap items-center gap-6">
<ExternalServicePill
indicator={indicator}
@@ -194,14 +220,24 @@ export default async function Page(args: { params: Promise<RouteParams> }) {
</a>
</div>
- <h2>Last {HISTORY_DAYS} days</h2>
+ <h2>
+ {service.name} uptime — last {HISTORY_DAYS} days
+ </h2>
<div className="not-prose">
<HistoryBars daily={historyRows} days={HISTORY_DAYS} />
</div>
- <Suspense fallback={null}>
+ <h2>{service.name} recent incidents</h2>
+ <Suspense
+ fallback={
+ <p className="text-muted-foreground">
+ Loading recent {service.name} incidents…
+ </p>
+ }
+ >
<Incidents
statusPageUrl={service.statusPageUrl}
+ serviceName={service.name}
apiConfigType={service.apiConfig?.type}
/>
</Suspense>
diff --git a/apps/web/src/app/(landing)/status/page.tsx b/apps/web/src/app/(landing)/status/page.tsx
index df2d2d2ff..30815fa3a 100644
--- a/apps/web/src/app/(landing)/status/page.tsx
+++ b/apps/web/src/app/(landing)/status/page.tsx
@@ -4,6 +4,7 @@ import { ExternalServicePill } from "@/app/(landing)/status/external-service-pil
import { components } from "@/content/mdx";
import { cachedListExternalServices } from "@/lib/external-service-cache";
import {
+ BASE_URL,
defaultMetadata,
ogMetadata,
twitterMetadata,
@@ -30,12 +31,13 @@ export const metadata: Metadata = {
...ogMetadata,
title: TITLE,
description: DESCRIPTION,
+ images: [`${BASE_URL}/api/og/external-service`],
},
twitter: {
...twitterMetadata,
title: TITLE,
description: DESCRIPTION,
- images: [`/api/og?title=${TITLE}&description=${DESCRIPTION}`],
+ images: [`${BASE_URL}/api/og/external-service`],
},
};
diff --git a/apps/web/src/app/(landing)/status/utils.ts b/apps/web/src/app/(landing)/status/utils.ts
index ae03650e2..554639598 100644
--- a/apps/web/src/app/(landing)/status/utils.ts
+++ b/apps/web/src/app/(landing)/status/utils.ts
@@ -16,3 +16,32 @@ export function formatRelative(updatedAtMs: number): string {
export function isStale(fetchedAtMs: number): boolean {
return Date.now() - fetchedAtMs > STALE_THRESHOLD_MS;
}
+
+// Natural-language answer to "Is <name> down?" — used both as on-page lead copy
+// and as the FAQPage answer in JSON-LD. Mirrors getPillStyle semantics.
+export function getStatusAnswer(args: {
+ name: string;
+ indicator: string;
+ status: string;
+ hasLiveData: boolean;
+}): string {
+ const { name, indicator, status, hasLiveData } = args;
+ if (!hasLiveData) {
+ return `We don't have live data for ${name} right now — check the official ${name} status page below.`;
+ }
+ if (status === "under_maintenance") {
+ return `${name} is currently undergoing scheduled maintenance.`;
+ }
+ switch (indicator) {
+ case "none":
+ return `No, ${name} is not down. All ${name} systems are operational.`;
+ case "minor":
+ return `${name} is up, but currently experiencing a minor issue.`;
+ case "major":
+ return `Yes, ${name} is experiencing a partial outage right now.`;
+ case "critical":
+ return `Yes, ${name} is down — a major outage is currently affecting ${name}.`;
+ default:
+ return `The current status of ${name} is unknown — check the official ${name} status page below.`;
+ }
+}
diff --git a/apps/web/src/app/api/og/external-service/route.tsx b/apps/web/src/app/api/og/external-service/route.tsx
new file mode 100644
index 000000000..2826edb7b
--- /dev/null
+++ b/apps/web/src/app/api/og/external-service/route.tsx
@@ -0,0 +1,215 @@
+import { ImageResponse } from "next/og";
+
+import { OSTinybird, safePipeData } from "@openstatus/tinybird";
+
+import { isStale } from "@/app/(landing)/status/utils";
+import { env } from "@/env";
+import {
+ cachedGetExternalServiceBySlug,
+ cachedListExternalServices,
+} from "@/lib/external-service-cache";
+import { cn } from "@/lib/utils";
+import { SIZE } from "../utils";
+
+export const runtime = "edge";
+
+const FOOTER = "openstatus.dev/status";
+const INDEX_TITLE = "External Status";
+const INDEX_DESCRIPTION =
+ "Check if your external providers are working properly";
+
+// Mirrors getPillStyle in (landing)/status/external-service-pill.tsx so the OG
+// label matches the on-page pill.
+function getStatus(args: { indicator: string; status: string }): {
+ label: string;
+ bg: string;
+ text: string;
+} {
+ if (args.status === "under_maintenance") {
+ return {
+ label: "Maintenance",
+ bg: "bg-blue-500/90 border-blue-500",
+ text: "text-blue-500",
+ };
+ }
+ switch (args.indicator) {
+ case "none":
+ return {
+ label: "Operational",
+ bg: "bg-green-500/90 border-green-500",
+ text: "text-green-500",
+ };
+ case "minor":
+ return {
+ label: "Minor Issue",
+ bg: "bg-amber-500/90 border-amber-500",
+ text: "text-amber-500",
+ };
+ case "major":
+ return {
+ label: "Partial Outage",
+ bg: "bg-orange-500/90 border-orange-500",
+ text: "text-orange-500",
+ };
+ case "critical":
+ return {
+ label: "Major Outage",
+ bg: "bg-rose-500/90 border-rose-500",
+ text: "text-rose-500",
+ };
+ default:
+ return {
+ label: "Unknown",
+ bg: "bg-gray-500/90 border-gray-500",
+ text: "text-gray-500",
+ };
+ }
+}
+
+const UNKNOWN = {
+ label: "Unknown",
+ bg: "bg-gray-500/90 border-gray-500",
+ text: "text-gray-500",
+};
+
+export async function GET(req: Request) {
+ const fontMonoRegular = await fetch(
+ new URL("../../../../public/fonts/RobotoMono-Regular.ttf", import.meta.url),
+ ).then((res) => res.arrayBuffer());
+ const fontMonoMedium = await fetch(
+ new URL("../../../../public/fonts/RobotoMono-Medium.ttf", import.meta.url),
+ ).then((res) => res.arrayBuffer());
+ const fontMonoBold = await fetch(
+ new URL("../../../../public/fonts/RobotoMono-Bold.ttf", import.meta.url),
+ ).then((res) => res.arrayBuffer());
+ const logoSvg = await fetch(
+ new URL(
+ "../../../../../public/assets/logos/OpenStatus-Logo.svg",
+ import.meta.url,
+ ),
+ ).then((res) => res.text());
+ const logoSrc = `data:image/svg+xml;base64,${btoa(logoSvg)}`;
+
+ const { searchParams } = new URL(req.url);
+ const slug = searchParams.get("slug") || undefined;
+
+ const service = slug ? await cachedGetExternalServiceBySlug(slug) : undefined;
+
+ let category: string;
+ let categoryDot: string | undefined;
+ let title: string;
+ let description: string;
+ let footer: string;
+
+ if (!service) {
+ const services = await cachedListExternalServices();
+ category = "external status";
+ title = INDEX_TITLE;
+ description = `${services.length} providers monitored — ${INDEX_DESCRIPTION}`;
+ footer = FOOTER;
+ } else {
+ const aliasSlugs = Array.isArray(service.aliases) ? service.aliases : [];
+ const slugChain = [service.slug, ...aliasSlugs];
+
+ const tb = new OSTinybird(env.TINY_BIRD_API_KEY);
+ const latestRes = await safePipeData(
+ tb.externalStatusLatest({ ids: slugChain }),
+ "externalStatusLatest (og)",
+ );
+ const latestRows = Array.isArray(latestRes.data) ? latestRes.data : [];
+ latestRows.sort((a, b) => b.last_fetched_at - a.last_fetched_at);
+ const latest = latestRows[0];
+
+ const fetchedAt = latest?.last_fetched_at ?? 0;
+ const stale = fetchedAt === 0 || isStale(fetchedAt);
+ const content = stale
+ ? UNKNOWN
+ : getStatus({
+ indicator: latest?.indicator ?? "",
+ status: latest?.status ?? "",
+ });
+
+ category = content.label;
+ categoryDot = content.bg;
+ title = `Is ${service.name} down?`;
+ description = "";
+ footer = `${FOOTER}/${service.slug}`;
+ }
+
+ return new ImageResponse(
+ <div tw="relative flex flex-col items-start justify-start w-full h-full bg-gray-100">
+ <div
+ tw="flex flex-col h-full p-8 w-full"
+ style={{ fontFamily: "Font Mono" }}
+ >
+ <div tw="flex flex-col justify-end flex-1 mb-8">
+ <div tw="flex flex-row items-center text-2xl text-slate-700">
+ [
+ {categoryDot ? (
+ <div tw={cn("rounded-full h-5 w-5 mr-2", categoryDot)} />
+ ) : null}
+ <p>{category}</p>]
+ {service
+ ? ` | ${new Date().toLocaleDateString(undefined, {
+ year: "numeric",
+ month: "long",
+ day: "numeric",
+ hour: "2-digit",
+ minute: "2-digit",
+ timeZoneName: "short",
+ timeZone: "UTC",
+ })}`
+ : ""}
+ </div>
+ <h1
+ tw="text-6xl text-black text-left font-medium"
+ style={{ lineClamp: 2, display: "block" }}
+ >
+ {title}
+ </h1>
+ {description ? (
+ <p
+ tw="text-4xl text-slate-700 text-left"
+ style={{ lineClamp: 2, display: "block" }}
+ >
+ {description}
+ </p>
+ ) : null}
+ </div>
+ <div tw="flex flex-row items-center text-slate-500">
+ <img
+ src={logoSrc}
+ width={24}
+ height={24}
+ alt="OpenStatus"
+ style={{ marginRight: 8 }}
+ />
+ <p tw="font-medium text-xl text-left">{footer}</p>
+ </div>
+ </div>
+ </div>,
+ {
+ ...SIZE,
+ fonts: [
+ {
+ name: "Font Mono",
+ data: fontMonoRegular,
+ style: "normal",
+ weight: 400,
+ },
+ {
+ name: "Font Mono",
+ data: fontMonoMedium,
+ style: "normal",
+ weight: 500,
+ },
+ {
+ name: "Font Mono",
+ data: fontMonoBold,
+ style: "normal",
+ weight: 700,
+ },
+ ],
+ },
+ );
+}