Dynamic Route
المسار الديناميكي
GLS-000084
Definition
A Next.js route that matches a variable URL segment — like /glossary/[slug] matching any term.
مسار Next.js يطابق جزءًا متغيرًا من URL — مثل /glossary/[slug] الذي يطابق أي مصطلح.
Why It Matters
Every glossary term page, project page, and prompt page on 404Fault uses a dynamic route. Without it, you'd need to create a separate file for each page.
كل صفحة مصطلح في الغلوساري وصفحة مشروع وصفحة برومبت في 404Fault تستخدم مسارًا ديناميكيًا. بدونه، ستحتاج إلى إنشاء ملف منفصل لكل صفحة.
Full Definition
Example Usage
“app/glossary/[slug]/page.tsx receives params.slug = 'nextjs' when the user visits /glossary/nextjs.”
“app/glossary/[slug]/page.tsx يستقبل params.slug = 'nextjs' عندما يزور المستخدم /glossary/nextjs.”
AI Builder Tips
Avoid these mistakes when using Dynamic Route:
Forgetting to await params in Next.js 15 (params is now a Promise)
Not handling the case where a slug doesn't exist — always call notFound()
Sign in to unlock guided AI explanations from AI Teacher.
Generate a Prompt
Copy this prompt and use it directly with any AI model — no setup needed.
Help me build a project using Dynamic Route. Explain: 1. What is Dynamic Route and why it matters 2. The core architecture and required tools 3. Step-by-step implementation plan 4. Common mistakes to avoid: Forgetting to await params in Next.js 15 (params is now a Promise), Not handling the case where a slug doesn't exist — always call notFound() 5. Best practices and production tips