feat: harden portfolio and add SEO foundations
This commit is contained in:
1 parent
b079afdd73
commit
62bcfbd8fa
121 files changed
+7769
-10469
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import { ImageResponse } from "next/og";
|
||||
import { OG_CONTENT_TYPE, OG_SIZE, OgCard } from "@/lib/og-card";
|
||||
import { getServicePage, servicePages } from "@/lib/site-content";
|
||||
|
||||
function getImageMetadata(service: (typeof servicePages)[number]) {
|
||||
return {
|
||||
id: service.slug,
|
||||
alt: `${service.navLabel} — Evandro Fonseca Junior`,
|
||||
size: OG_SIZE,
|
||||
contentType: OG_CONTENT_TYPE,
|
||||
};
|
||||
}
|
||||
|
||||
export function generateImageMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: { slug?: string };
|
||||
}) {
|
||||
if (!params.slug) {
|
||||
return servicePages.map(getImageMetadata);
|
||||
}
|
||||
|
||||
const service = getServicePage(params.slug);
|
||||
if (!service) notFound();
|
||||
return [getImageMetadata(service)];
|
||||
}
|
||||
|
||||
export default async function Image({
|
||||
params,
|
||||
id,
|
||||
}: {
|
||||
params: Promise<{ slug: string }>;
|
||||
id: Promise<string | number>;
|
||||
}) {
|
||||
const [{ slug }, imageId] = await Promise.all([params, id]);
|
||||
const service = getServicePage(slug);
|
||||
if (!service || imageId !== service.slug) notFound();
|
||||
|
||||
return new ImageResponse(
|
||||
<OgCard
|
||||
eyebrow={service.eyebrow}
|
||||
title={service.headline}
|
||||
description={service.answer}
|
||||
/>,
|
||||
OG_SIZE,
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user