Skip to content

armgit / pdfcn

Public Imported from GitHub
0

Beautiful pdf components, built on Takumi and Forme. 100% Free, Zero config, one command setup.

Add Changelog page and update routing

Aniket-508a81643c83348
diff --git a/app/(app)/docs/[[...slug]]/page.tsx b/app/(app)/docs/[[...slug]]/page.tsx
index 38a78d8..9fe0fe1 100644
--- a/app/(app)/docs/[[...slug]]/page.tsx
+++ b/app/(app)/docs/[[...slug]]/page.tsx
@@ -27,7 +27,8 @@ export const revalidate = false;
export const dynamic = "force-static";
export const dynamicParams = false;
-export const generateStaticParams = () => source.generateParams();
+export const generateStaticParams = () =>
+ source.generateParams().filter((param) => param.slug?.[0] !== "changelog");
export const generateMetadata = async (props: {
params: Promise<{ slug?: string[] }>;
diff --git a/app/(app)/docs/changelog/page.tsx b/app/(app)/docs/changelog/page.tsx
new file mode 100644
index 0000000..8e3cd3a
--- /dev/null
+++ b/app/(app)/docs/changelog/page.tsx
@@ -0,0 +1,140 @@
+import { RssIcon } from "lucide-react";
+import Link from "next/link";
+
+import { DocsTocFooter } from "@/components/docs-toc-footer";
+import { PageTransition } from "@/components/page-transition";
+import { Button } from "@/components/ui/button";
+import { ROUTES } from "@/constants/routes";
+import { getChangelogPages } from "@/lib/changelog";
+import type { ChangelogPageData } from "@/lib/changelog";
+import { mdxComponents } from "@/mdx-components";
+import { createPageMetadata } from "@/seo/metadata";
+
+export const revalidate = false;
+export const dynamic = "force-static";
+
+const NUMBER_OF_LATEST_PAGES = 5;
+
+export const metadata = createPageMetadata({
+ description: "Latest updates and announcements for pdfcn.",
+ ogType: "article",
+ path: ROUTES.DOCS_CHANGELOG,
+ title: "Changelog",
+});
+
+export default function ChangelogPage() {
+ const pages = getChangelogPages();
+ const latestPages = pages.slice(0, NUMBER_OF_LATEST_PAGES);
+ const olderPages = pages.slice(NUMBER_OF_LATEST_PAGES);
+
+ return (
+ <PageTransition>
+ <div
+ className="flex items-stretch text-[1.05rem] sm:text-[15px] xl:w-full"
+ data-slot="docs"
+ >
+ <div className="flex min-w-0 flex-1 flex-col">
+ <div className="h-(--top-spacing) shrink-0" />
+ <div className="mx-auto flex w-full max-w-2xl min-w-0 flex-1 flex-col gap-8 px-4 py-6 text-neutral-800 md:px-0 lg:py-8 dark:text-neutral-300">
+ <div className="flex flex-col gap-2">
+ <div className="flex items-center justify-between">
+ <h1 className="scroll-m-20 text-4xl font-semibold tracking-tight sm:text-3xl xl:text-4xl">
+ Changelog
+ </h1>
+ <Button asChild size="sm" variant="secondary">
+ <a
+ href={ROUTES.RSS}
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ <RssIcon />
+ RSS
+ </a>
+ </Button>
+ </div>
+ <p className="text-muted-foreground text-[1.05rem] text-balance sm:text-base">
+ Latest updates and announcements for pdfcn.
+ </p>
+ </div>
+ <div className="w-full flex-1 *:data-[slot=alert]:first:mt-0">
+ {latestPages.map((page) => {
+ const data = page.data as ChangelogPageData;
+ const MDX = page.data.body;
+
+ return (
+ <article className="mb-12 border-b pb-12" key={page.url}>
+ <h2 className="font-heading text-xl font-semibold tracking-tight">
+ {data.title}
+ </h2>
+ <div className="prose-changelog mt-6 *:first:mt-0">
+ <MDX components={mdxComponents} />
+ </div>
+ </article>
+ );
+ })}
+ {olderPages.length > 0 && (
+ <div className="mb-24 scroll-mt-24" id="more-updates">
+ <h2 className="mb-6 font-heading text-xl font-semibold tracking-tight">
+ More Updates
+ </h2>
+ <div className="grid auto-rows-fr gap-3 sm:grid-cols-2">
+ {olderPages.map((page) => {
+ const data = page.data as ChangelogPageData;
+ const [date, ...titleParts] = data.title.split(" - ");
+ const title = titleParts.join(" - ");
+
+ return (
+ <Link
+ className="flex w-full flex-col rounded-xl bg-surface px-4 py-3 text-surface-foreground transition-colors hover:bg-surface/80"
+ href={page.url}
+ key={page.url}
+ >
+ <span className="text-xs text-muted-foreground">
+ {date}
+ </span>
+ <span className="text-sm font-medium">{title}</span>
+ </Link>
+ );
+ })}
+ </div>
+ </div>
+ )}
+ </div>
+ </div>
+ </div>
+ <div className="sticky top-[calc(var(--header-height)+1px)] z-30 ml-auto hidden h-[calc(100svh-var(--footer-height)+2rem)] w-72 flex-col gap-4 overflow-hidden overscroll-none pb-8 xl:flex">
+ <div className="h-(--top-spacing) shrink-0" />
+ <div className="no-scrollbar mx-8 overflow-y-auto border-b">
+ <div className="flex flex-col gap-2 p-4 pt-0 text-sm">
+ <p className="sticky top-0 h-6 bg-background text-xs font-medium text-muted-foreground">
+ On This Page
+ </p>
+ {latestPages.map((page) => {
+ const data = page.data as ChangelogPageData;
+
+ return (
+ <Link
+ className="text-[0.8rem] text-muted-foreground no-underline transition-colors hover:text-foreground"
+ href={page.url}
+ key={page.url}
+ >
+ {data.title}
+ </Link>
+ );
+ })}
+ {olderPages.length > 0 && (
+ <a
+ className="text-[0.8rem] text-muted-foreground no-underline transition-colors hover:text-foreground"
+ href="#more-updates"
+ >
+ More Updates
+ </a>
+ )}
+ </div>
+ </div>
+ <DocsTocFooter className="mx-8" docId="" />
+ </div>
+ </div>
+ </PageTransition>
+ );
+}
diff --git a/components/docs-sidebar.tsx b/components/docs-sidebar.tsx
index 3f0c411..f48f902 100644
--- a/components/docs-sidebar.tsx
+++ b/components/docs-sidebar.tsx
@@ -19,6 +19,7 @@ import {
getDocsSidebarPanel,
isBlocksFolder,
isComponentsFolder,
+ PAGES_NEW,
} from "@/lib/docs";
import {
findBaseFolder,
@@ -46,6 +47,9 @@ const SidebarMenuItemLink = ({
<Link href={href}>
<span className="absolute inset-0 flex w-(--sidebar-menu-width) bg-transparent" />
{children}
+ {PAGES_NEW.includes(href) && (
+ <span className="flex size-2 rounded-full bg-blue-500" title="New" />
+ )}
</Link>
</SidebarMenuButton>
</SidebarMenuItem>
diff --git a/constants/nav.ts b/constants/nav.ts
index 8b89347..d7ead75 100644
--- a/constants/nav.ts
+++ b/constants/nav.ts
@@ -53,4 +53,5 @@ export const TOP_LEVEL_SECTIONS = [
{ href: ROUTES.DOCS_MCP, name: "MCP" },
{ href: ROUTES.DOCS_REGISTRY, name: "Registry" },
{ href: ROUTES.LLMS, name: "llms.txt" },
+ { href: ROUTES.DOCS_CHANGELOG, name: "Changelog" },
];
diff --git a/constants/routes.ts b/constants/routes.ts
index 89eb3aa..f1a3257 100644
--- a/constants/routes.ts
+++ b/constants/routes.ts
@@ -5,6 +5,7 @@ export const ROUTES = {
API_STATUS: "/api/status",
DOCS: "/docs",
DOCS_BLOCKS: "/docs/blocks",
+ DOCS_CHANGELOG: "/docs/changelog",
DOCS_COMPONENTS: "/docs/components",
DOCS_INSTALLATION: "/docs/installation",
DOCS_MCP: "/docs/mcp",
diff --git a/content/docs/(root)/changelog/2026-08-11-initial-release.mdx b/content/docs/(root)/changelog/2026-08-11-initial-release.mdx
new file mode 100644
index 0000000..7ea8e2f
--- /dev/null
+++ b/content/docs/(root)/changelog/2026-08-11-initial-release.mdx
@@ -0,0 +1,16 @@
+---
+title: August 11, 2026 - Initial Release
+description: PDF components for React PDF, React PDF Renderer, and JSX PDF.
+date: 2026-08-11
+---
+
+import { PlusIcon } from "lucide-react";
+import { FormeIcon, TakumiIcon } from "@/components/icons";
+
+We shipped the initial release of pdfcn with ready-to-use PDF components for Takumi PDF and Forme PDF.
+
+<div className="mt-6 flex w-full items-center justify-center gap-4 rounded-lg border bg-muted/50 py-32">
+ <TakumiIcon className="size-12" />
+ <PlusIcon className="size-8 text-muted-foreground" />
+ <FormeIcon className="size-12" />
+</div>
diff --git a/content/docs/(root)/changelog/index.mdx b/content/docs/(root)/changelog/index.mdx
new file mode 100644
index 0000000..d8a7016
--- /dev/null
+++ b/content/docs/(root)/changelog/index.mdx
@@ -0,0 +1,8 @@
+---
+title: Changelog
+description: Latest updates and announcements for pdfcn.
+---
+
+## August 2026 - Initial Release
+
+We shipped the initial release of pdfcn with ready-to-use PDF components for Takumi PDF and Forme PDF.
diff --git a/content/docs/(root)/changelog/meta.json b/content/docs/(root)/changelog/meta.json
new file mode 100644
index 0000000..72deac9
--- /dev/null
+++ b/content/docs/(root)/changelog/meta.json
@@ -0,0 +1,4 @@
+{
+ "title": "Changelog",
+ "pages": [""]
+}
diff --git a/lib/changelog.ts b/lib/changelog.ts
index bd79390..b29efb4 100644
--- a/lib/changelog.ts
+++ b/lib/changelog.ts
@@ -13,13 +13,35 @@ export type ChangelogPage = ReturnType<typeof source.getPages>[number] & {
date: Date | null;
};
+const DOCS_ROOT = path.join(process.cwd(), DOCS_DIR);
+
+const resolveSourceFile = (slugs: string[]): string | null => {
+ const relativePath = `${path.join(...slugs)}.mdx`;
+ const directPath = path.join(DOCS_ROOT, relativePath);
+
+ if (fs.existsSync(directPath)) {
+ return directPath;
+ }
+
+ for (const entry of fs.readdirSync(DOCS_ROOT, { withFileTypes: true })) {
+ if (!entry.isDirectory() || !entry.name.startsWith("(")) {
+ continue;
+ }
+
+ const groupedPath = path.join(DOCS_ROOT, entry.name, relativePath);
+ if (fs.existsSync(groupedPath)) {
+ return groupedPath;
+ }
+ }
+
+ return null;
+};
+
export const getDateFromFile = (slugs: string[]) => {
- const filePath = path.join(
- process.cwd(),
- DOCS_DIR,
- ...slugs.slice(0, -1),
- `${slugs.at(-1)}.mdx`
- );
+ const filePath = resolveSourceFile(slugs);
+ if (!filePath) {
+ return null;
+ }
try {
const content = fs.readFileSync(filePath, "utf-8");
diff --git a/lib/docs.ts b/lib/docs.ts
index a78cb4c..d3186af 100644
--- a/lib/docs.ts
+++ b/lib/docs.ts
@@ -4,7 +4,11 @@ import { formatLabelFromSlug } from "@/lib/utils";
export const DOCS_DIR = `content${ROUTES.DOCS}`;
-export const EXCLUDED_SECTIONS = new Set(["installation", "(root)"]);
+export const EXCLUDED_SECTIONS = new Set([
+ "installation",
+ "changelog",
+ "(root)",
+]);
export const isComponentsFolder = (folder: PageTreeFolder) =>
folder.$id === "components" || folder.name === "Components";
@@ -40,3 +44,5 @@ export const formatTitleFromSlug = (slug: string): string =>
export const homeContentRoute = `${ROUTES.LLMS_MD}/content.md`;
export const docsContentRoute = `${ROUTES.LLMS_MD}${ROUTES.DOCS}`;
export const docsImageRoute = `${ROUTES.OG}${ROUTES.DOCS}`;
+
+export const PAGES_NEW: string[] = [ROUTES.DOCS_CHANGELOG];