Next.js Easy technical 1 views 1 min read

How do you handle metadata and SEO in the App Router?

Peer-reviewed by HireXTech Technical Panel Updated for 2025/2026 hiring Editorial standards
Practise this track
Interviewer Expectations for this Question
01
Core Competency

Assesses fundamental understanding of Next.js conventions, runtime behavior, and memory/performance considerations.

02
Evaluation Criteria

Hiring managers look for precision, avoidance of ambiguous jargon, and ability to explain trade-offs under real production conditions.

Comprehensive Model Answer Verified Solution

You export a static metadata object or a generateMetadata async function from a layout or page. It can set title, description, canonical URL, Open Graph, Twitter cards and robots directives.

export const metadata: Metadata = {
  title: 'Blog',
  description: 'Articles about web development',
  openGraph: { images: ['/og.png'] },
};

Metadata merges along the route hierarchy, so layouts set sensible defaults and pages override them. generateMetadata receives params and searchParams and can fetch data, and Next deduplicates those requests automatically.

next/font inlines and self-hosts fonts with no layout shift, and next/image provides responsive images, lazy loading and modern formats, which help Core Web Vitals and therefore SEO. Add sitemap.ts, robots.ts and structured JSON-LD for richer results.

Because the server renders your content, crawlers do not need to execute JavaScript. Always verify metadata renders in the built output, not just in dev mode.

Candidate Response Strategy & Interview Tips

  1. Start with a concise one-sentence summary: Deliver a direct, confident answer first before expanding into nuances.
  2. Demonstrate real-world trade-offs: Discuss where this approach excels and when you would avoid it in production systems.
  3. Discuss complexity & edge cases: Proactively explain time/space complexity or boundary conditions (null values, scale limits).
  4. Prepare for interviewer follow-ups: Technical hiring panels frequently probe deeper into concurrency, backward compatibility, or alternative libraries.
Related Topics & Skills
Spotted an error or have an alternative solution?