generated from Nicholai/astro-template
2.4 KiB
2.4 KiB
CLAUDE.md
Development guidance for this Astro template repository.
Commands
Core Development
pnpm dev # Development server
pnpm build # Build for production
pnpm preview # Preview build with Wrangler
pnpm deploy # Deploy to Cloudflare Pages
Utilities
pnpm commit # AI-powered commit messages
pnpm convert:avif:all # Convert all images to AVIF
pnpm convert:avif:jpeg
pnpm convert:avif:png
pnpm cf-typegen # Generate Cloudflare types
Change Documentation
IMPORTANT: Update dev/continuity.md when making changes to document:
- What changed and why
- Decisions made
- Next steps
Architecture
Minimal Astro template with content-driven architecture:
Content Layer (src/content/)
- blog/ - MDX blog posts with schema validation
- sections/ - Homepage sections (hero, experience, skills, featured-project)
- pages/ - Page-specific content (contact)
Schema defined in src/content.config.ts
Component Layer
- Core UI: BlogCard, FormattedDate, Navigation, Footer, GridOverlay
- Blog: BlogFilters, ReadingProgress, TableOfContents, PostNavigation, RelatedPosts
- Sections: Hero, Experience, Skills, FeaturedProject
Routes
- Static routes in
src/pages/ - Dynamic blog routes via
[...slug].astro - Layouts in
src/layouts/
Data Flow
Blog Index (src/pages/blog/index.astro):
- Fetch all posts via
getCollection('blog') - Sort by pubDate (newest first)
- Identify featured post (first with
featured: true) - Render featured hero + filterable grid
- Extract categories for filter UI
Individual Posts (src/pages/blog/[...slug].astro):
getStaticPaths()generates routes- Calculate previous/next posts (by date)
- Find related posts (matching category/tags, limit 3)
- Calculate reading time (200 wpm)
- Pass to
BlogPostlayout
Image Handling
src/assets/- Processed by Astro (relative paths)public/media/- Served as-is (absolute paths like/media/file.mp4)- AVIF conversion utility available
Deployment
- Cloudflare Pages adapter configured
- Image service: "compile" mode
- Platform proxy enabled for development
Utility Scripts
src/utils/convert-to-avif.js- Image optimizationsrc/utils/git-commit.js- AI commit message generation (requires OpenRouter API key insrc/utils/.env)