Overview
AnimeThemes Web uses Next.js Pages Router (not App Router) for file-system based routing. Each file in thesrc/pages directory automatically becomes a route.
Page Structure
Root Pages
Homepage (index.tsx)
Homepage (index.tsx)
- Static generation with featured theme
- Announcement cards with MDX rendering
- Quick navigation to search, shuffle, current season
- Recently added videos and playlists
Application Wrapper
Dynamic Routes
Single Dynamic Segment
- Anime Detail
- Artist Detail
- Studio Detail
Route: URL Example:
/anime/[animeSlug]/anime/cowboy-bebopNested Dynamic Routes
Video Detail Page
Video Detail Page
Route: URL Example:
/anime/[animeSlug]/[videoSlug]/anime/cowboy-bebop/OP-NCBD1080Video Slug Format: {type}{sequence?}-{tags}{resolution}- Type: OP (opening), ED (ending)
- Sequence: 1, 2, 3, etc. (optional)
- Tags: NC (no credits), BD (Blu-ray), etc.
- Resolution: 1080, 720, 480
Multi-Segment Catch-All Routes
/wiki/installation/blog/2024-annual-awards
Static Path Generation
The app uses a customfetchStaticPaths utility to optimize build times:
Incremental Static Regeneration (ISR)
Pages are regenerated in the background based on therevalidate prop:
1 Hour Revalidation
Most content pages (anime, artists, studios)
No Revalidation
Static content (wiki, blog)
Page Layout Modes
Pages can specify layout variants via props:Navigation Between Pages
Programmatic Navigation
Link Component
API Routes
The/api directory contains serverless functions:
Route Patterns Summary
| Pattern | Example | Use Case |
|---|---|---|
index.tsx | / | Homepage |
about.tsx | /about | Static page |
[slug].tsx | /anime/[animeSlug] | Dynamic single segment |
[slug]/[id].tsx | /anime/[animeSlug]/[videoSlug] | Nested dynamic |
[...slug].tsx | /wiki/[...pageSlug] | Catch-all route |
Best Practices
Use ISR for Content Pages
Set appropriate revalidation times for content that changes periodically
Build-Time Caching
Cache API responses during
getStaticPaths to avoid redundant requests in getStaticPropsType Safety
Define
ParsedUrlQuery interfaces for all dynamic route paramsShared Props Pattern
Use
getSharedPageProps() to inject common data like build time and API request countRelated Resources
Next.js Pages Router Documentation
Official Next.js documentation for the Pages Router