Files
blog-nextjs/.gitignore
gbanyan e28beac1f1 Fix Pagefind file serving with API route
Fixed issue where Pagefind static files weren't accessible due to Next.js routing conflicts.

Solution:
- Created API route at app/pagefind/[...path]/route.ts to serve Pagefind files from .next/pagefind/
- Updated build script to copy pagefind index to public/_pagefind (backup)
- API route handles all /pagefind/* requests and serves files with proper content types
- Added caching headers for optimal performance

This resolves the "cannot type in search" issue - the search modal can now load Pagefind UI and index files correctly.

Technical Details:
- Next.js App Router was treating /pagefind/ as a route, returning 404
- Static files in public/ weren't accessible for subdirectories due to routing priority
- API route bypasses routing to serve .next/pagefind/* files directly
- Supports .js, .css, .json, .wasm, and Pagefind-specific file types

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 02:26:38 +08:00

45 lines
463 B
Plaintext

# Dependencies
/node_modules
# Next.js build output
/.next
/out
# Production env files
.env
.env.local
.env.*.local
# Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# OS / Editor junk
.DS_Store
*.swp
*.swo
.idea/
.vscode/
# Testing / coverage
/coverage
# Misc tool caches
/.turbo
.next-tmp
.contentlayer
# Vercel
.vercel
# Generated assets mirror
/public/assets
# Generated search index
/public/_pagefind
# TypeScript
*.tsbuildinfo