mirror of
https://github.com/zenlm/zen-blog.git
synced 2026-11-03 14:11:45 +00:00
The home now says who makes Zen LM, Zoo Labs Foundation, a 501(c)(3) non-profit, the two jobs it is chosen for, that Zen 6 and Zen 6 Flash are available now, and that Zen 7 is a research preview with a link to request access. The footer names the foundation, and "Qwen" leaves the site keywords. Posts marked "upstream: true" carry data-upstream on their page, card and read-more link, and scripts/check-zen.mjs fails the build when a name from zen.upstream shows anywhere else. The build stops measuring remote images: fumadocs fetched every one to read its size, and a single host answering 403 failed the build.
99 lines
2.7 KiB
TypeScript
99 lines
2.7 KiB
TypeScript
import { Metadata } from "next";
|
|
import { docs, meta } from "@/.source";
|
|
import { loader } from "fumadocs-core/source";
|
|
import { createMDXSource } from "fumadocs-mdx";
|
|
import { siteConfig } from "@/lib/site";
|
|
|
|
const blogSource = loader({
|
|
baseUrl: "/blog",
|
|
source: createMDXSource(docs, meta),
|
|
});
|
|
|
|
export async function generateMetadata({
|
|
params,
|
|
}: {
|
|
params: Promise<{ slug: string }>;
|
|
}): Promise<Metadata> {
|
|
try {
|
|
const { slug } = await params;
|
|
|
|
if (!slug || slug.length === 0) {
|
|
return {
|
|
title: "Post Not Found",
|
|
description: "The requested blog post could not be found.",
|
|
};
|
|
}
|
|
|
|
const page = blogSource.getPage([slug]);
|
|
|
|
if (!page) {
|
|
return {
|
|
title: "Post Not Found",
|
|
description: "The requested blog post could not be found.",
|
|
};
|
|
}
|
|
|
|
const ogUrl = `${siteConfig.url}/blog/${slug}`;
|
|
|
|
return {
|
|
title: page.data.title,
|
|
description: page.data.description,
|
|
keywords: [
|
|
page.data.title,
|
|
...(Array.isArray(page.data.tags) ? page.data.tags : []),
|
|
"Zen LM",
|
|
"Blog",
|
|
"AI Research",
|
|
"Open Source",
|
|
],
|
|
authors: [
|
|
{
|
|
name: typeof page.data.author === 'string' ? page.data.author : "Zen LM",
|
|
url: siteConfig.url,
|
|
},
|
|
],
|
|
creator: typeof page.data.author === 'string' ? page.data.author : "Zen LM",
|
|
publisher: "Zen LM",
|
|
robots: {
|
|
index: true,
|
|
follow: true,
|
|
googleBot: {
|
|
index: true,
|
|
follow: true,
|
|
"max-video-preview": -1,
|
|
"max-image-preview": "large",
|
|
"max-snippet": -1,
|
|
},
|
|
},
|
|
openGraph: {
|
|
title: page.data.title,
|
|
description: page.data.description,
|
|
type: "article",
|
|
url: ogUrl,
|
|
publishedTime: typeof page.data.date === 'string' ? page.data.date : undefined,
|
|
authors: [typeof page.data.author === 'string' ? page.data.author : "Zen LM"],
|
|
tags: Array.isArray(page.data.tags) ? page.data.tags : undefined,
|
|
siteName: siteConfig.name,
|
|
},
|
|
twitter: {
|
|
card: "summary_large_image",
|
|
title: page.data.title,
|
|
description: page.data.description,
|
|
creator: "@zenlm",
|
|
site: "@zenlm",
|
|
},
|
|
alternates: {
|
|
canonical: ogUrl,
|
|
},
|
|
// A post about another lab's release names it; the Zen copy check reads this.
|
|
...(page.data.upstream ? { other: { "data-upstream": "true" } } : {}),
|
|
};
|
|
} catch (error) {
|
|
console.error("Error generating metadata:", error);
|
|
return {
|
|
title: "Post Not Found",
|
|
description: "The requested blog post could not be found.",
|
|
};
|
|
}
|
|
}
|