mirror of
https://github.com/dathere/ckan-devstaller.git
synced 2025-11-09 21:39:49 +00:00
feat: add /docs deployed at https://ckan-devstaller.dathere.com
This commit is contained in:
parent
16088fc929
commit
64708d2d68
26 changed files with 1376 additions and 0 deletions
34
docs/app/og/docs/[...slug]/route.tsx
Normal file
34
docs/app/og/docs/[...slug]/route.tsx
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { generate as DefaultImage } from "fumadocs-ui/og";
|
||||
import { notFound } from "next/navigation";
|
||||
import { ImageResponse } from "next/og";
|
||||
import { getPageImage, source } from "@/lib/source";
|
||||
|
||||
export const revalidate = false;
|
||||
|
||||
export async function GET(
|
||||
_req: Request,
|
||||
{ params }: RouteContext<"/og/docs/[...slug]">,
|
||||
) {
|
||||
const { slug } = await params;
|
||||
const page = source.getPage(slug.slice(0, -1));
|
||||
if (!page) notFound();
|
||||
|
||||
return new ImageResponse(
|
||||
<DefaultImage
|
||||
title={page.data.title}
|
||||
description={page.data.description}
|
||||
site="ckan-devstaller"
|
||||
/>,
|
||||
{
|
||||
width: 1200,
|
||||
height: 630,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function generateStaticParams() {
|
||||
return source.getPages().map((page) => ({
|
||||
lang: page.locale,
|
||||
slug: getPageImage(page).segments,
|
||||
}));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue