From 049bc3e7a39604c36b84f60edc027614433005ee Mon Sep 17 00:00:00 2001 From: Krishna Ayyalasomayajula Date: Mon, 1 Jun 2026 23:54:23 -0500 Subject: [PATCH] Revert "feat: serve content files via catch-all route, use content-relative cover images" This reverts commit 8d582b6ae3a396bc0971b4dfb117882bf37d8de2. --- app/content/[...path]/route.ts | 42 -------------------------------- content/posts/euler-identity.mdx | 2 +- content/posts/hello-world.mdx | 2 +- content/posts/hybrid-post.mdx | 2 +- next.config.ts | 4 ++- 5 files changed, 6 insertions(+), 46 deletions(-) delete mode 100644 app/content/[...path]/route.ts diff --git a/app/content/[...path]/route.ts b/app/content/[...path]/route.ts deleted file mode 100644 index d76a148..0000000 --- a/app/content/[...path]/route.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { NextResponse } from 'next/server'; -import { readFileSync, existsSync } from 'node:fs'; -import { join } from 'node:path'; - -const CONTENT_DIR = join(process.cwd(), 'content'); - -const MIME_TYPES: Record = { - '.jpg': 'image/jpeg', - '.jpeg': 'image/jpeg', - '.png': 'image/png', - '.gif': 'image/gif', - '.webp': 'image/webp', - '.svg': 'image/svg+xml', - '.pdf': 'application/pdf', - '.txt': 'text/plain', - '.md': 'text/plain', - '.mdx': 'text/plain', -}; - -export async function GET( - _request: Request, - { params }: { params: Promise<{ path: string[] }> }, -) { - const { path } = await params; - const decodedPath = decodeURIComponent(path.join('/')); - const fullPath = join(CONTENT_DIR, decodedPath); - - if (!fullPath.startsWith(CONTENT_DIR) || !existsSync(fullPath)) { - return new NextResponse('Not found', { status: 404 }); - } - - const ext = '.' + fullPath.split('.').pop()!; - const contentType = MIME_TYPES[ext] ?? 'application/octet-stream'; - const data = readFileSync(fullPath); - - return new NextResponse(data, { - headers: { - 'Content-Type': contentType, - 'Cache-Control': 'public, max-age=31536000, immutable', - }, - }); -} diff --git a/content/posts/euler-identity.mdx b/content/posts/euler-identity.mdx index 7ff881f..9a01f72 100644 --- a/content/posts/euler-identity.mdx +++ b/content/posts/euler-identity.mdx @@ -7,7 +7,7 @@ tags: - mathematics - euler - complex-numbers -coverImage: /content/posts/euler-identity/euler-cover.jpg +coverImage: /images/euler-cover.jpg --- Euler's identity is widely regarded as the most beautiful equation in all of mathematics: diff --git a/content/posts/hello-world.mdx b/content/posts/hello-world.mdx index d9748c7..cca53d3 100644 --- a/content/posts/hello-world.mdx +++ b/content/posts/hello-world.mdx @@ -7,7 +7,7 @@ tags: - typescript - programming - tutorial -coverImage: /content/posts/hello-world/typescript-cover.jpg +coverImage: /images/typescript-cover.jpg --- Welcome to this comprehensive TypeScript tutorial! Whether you are migrating a JavaScript project or starting fresh, this guide will walk you through TypeScript's type system from fundamentals to advanced patterns used in production codebases. diff --git a/content/posts/hybrid-post.mdx b/content/posts/hybrid-post.mdx index 42fe178..8f58f44 100644 --- a/content/posts/hybrid-post.mdx +++ b/content/posts/hybrid-post.mdx @@ -8,7 +8,7 @@ tags: - signal-processing - tutorial author: James Liu -coverImage: /content/posts/hybrid-post/fourier-cover.jpg +coverImage: /images/fourier-cover.jpg --- ## Fourier Analysis: From Mathematical Theory to Python Practice diff --git a/next.config.ts b/next.config.ts index a758e9c..36721af 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,9 @@ import type { NextConfig } from 'next' const nextConfig: NextConfig = { - // Trailing slash for clean URLs + // Static export — generates out/ directory with plain HTML + output: 'export', + // Trailing slash for clean static URLs trailingSlash: true, // Images: unoptimized required for static export images: {