0
0
NextJSframework~15 mins

Metadata API for SEO in NextJS - Deep Dive

Choose your learning style9 modes available
Overview - Metadata API for SEO
What is it?
The Metadata API in Next.js is a way to add information about your web pages that search engines and social media platforms use to understand and display your site better. This information includes titles, descriptions, keywords, and social sharing details. It helps your pages show up nicely in search results and when shared on social media. You add this metadata directly in your Next.js components using a simple, structured approach.
Why it matters
Without proper metadata, your website might not appear clearly or attractively in search engines or social media previews. This can reduce visitors and hurt your site's visibility. The Metadata API solves this by making it easy to add and manage SEO-related information, improving how your site is found and shared. It helps your website stand out and reach more people, which is crucial for success online.
Where it fits
Before learning the Metadata API, you should understand basic Next.js concepts like pages, components, and routing. Knowing HTML basics, especially the head element and meta tags, helps too. After mastering this, you can explore advanced SEO techniques, dynamic metadata, and performance optimization in Next.js.
Mental Model
Core Idea
The Metadata API lets you tell search engines and social platforms what your page is about by adding special information inside your Next.js components.
Think of it like...
It's like putting a label on a gift box that tells the delivery person what's inside and how to handle it, so it reaches the right person looking nice.
┌─────────────────────────────┐
│ Next.js Page Component       │
│ ┌─────────────────────────┐ │
│ │ Metadata API Section     │ │
│ │ ┌─────────────────────┐ │ │
│ │ │ <title>, <meta> tags │ │ │
│ │ └─────────────────────┘ │ │
│ └─────────────────────────┘ │
└─────────────────────────────┘
          ↓
┌─────────────────────────────┐
│ HTML Document Head           │
│ ┌─────────────────────────┐ │
│ │ <title>, <meta> tags     │ │
│ └─────────────────────────┘ │
└─────────────────────────────┘
          ↓
┌─────────────────────────────┐
│ Search Engines & Social     │
│ Platforms Read Metadata     │
└─────────────────────────────┘
Build-Up - 7 Steps
1
FoundationWhat is Metadata in Web Pages
🤔
Concept: Metadata is information about a web page that is not shown directly on the page but helps search engines and browsers understand it.
Web pages have a special section called the head where metadata lives. This includes the page title, description, and keywords. These help search engines know what the page is about and how to show it in search results.
Result
You understand that metadata is separate from visible content but important for search and sharing.
Knowing that metadata is hidden but powerful helps you see why it needs special handling in web frameworks.
2
FoundationHow Next.js Handles Page Metadata
🤔
Concept: Next.js uses a special component to add metadata inside your page components, making it easy to manage SEO info.
In Next.js, you can use the built-in Head component to add metadata tags inside your page or layout components. This Head component ensures metadata is added to the HTML head section when the page loads.
Result
You can add titles and meta tags in your Next.js pages that appear correctly in the browser and search engines.
Understanding that Next.js abstracts metadata insertion lets you focus on content, not HTML details.
3
IntermediateUsing the Metadata API in Next.js 13+
🤔Before reading on: do you think metadata is added by manually editing HTML files or by code inside components? Commit to your answer.
Concept: Next.js 13 introduced a Metadata API that lets you define metadata as an object or function in your page or layout files, simplifying SEO management.
Instead of manually writing tags, you export a metadata object from your page or layout file. This object includes title, description, openGraph, twitter, and other SEO properties. Next.js automatically converts this into proper meta tags.
Result
Your metadata is cleaner, easier to maintain, and automatically handled by Next.js during rendering.
Knowing metadata can be defined declaratively as data rather than markup reduces errors and improves consistency.
4
IntermediateDynamic Metadata with Async Functions
🤔Before reading on: can metadata in Next.js be static only, or can it change based on data? Commit to your answer.
Concept: Metadata can be generated dynamically using async functions, allowing SEO info to reflect real-time data or user input.
You can export an async function called generateMetadata that fetches data (like from an API) and returns a metadata object. This lets your page metadata update based on content or user context.
Result
Your pages have SEO metadata that matches the actual content dynamically, improving relevance and search ranking.
Understanding dynamic metadata unlocks powerful SEO strategies for personalized or frequently updated content.
5
AdvancedMetadata Inheritance and Layouts
🤔Before reading on: do you think metadata defined in layouts affects child pages automatically? Commit to your answer.
Concept: Metadata defined in layout files applies to all nested pages, allowing shared SEO info and overrides for specific pages.
Next.js lets you define metadata in layout.js files. Child pages inherit this metadata unless they override it. This helps keep consistent titles, descriptions, and social tags across sections of your site.
Result
You can manage SEO metadata efficiently across large sites with shared layouts and page-specific overrides.
Knowing metadata inheritance prevents duplication and keeps SEO consistent across your app.
6
ExpertHow Next.js Renders Metadata for SEO
🤔Before reading on: do you think metadata is added only on the client side or also on the server side? Commit to your answer.
Concept: Next.js renders metadata on the server during page generation, ensuring search engines see the correct metadata immediately.
When you use the Metadata API, Next.js generates the meta tags during server-side rendering or static generation. This means crawlers and social platforms get the metadata without waiting for JavaScript to run, improving SEO and performance.
Result
Your pages have fast, SEO-friendly metadata visible to search engines and social previews right away.
Understanding server-side metadata rendering explains why Next.js SEO works better than client-only approaches.
7
ExpertCommon Pitfalls and Best Practices
🤔Before reading on: do you think missing metadata breaks your site or just reduces SEO quality? Commit to your answer.
Concept: Missing or incorrect metadata doesn't break your site but can hurt SEO and user experience; best practices help avoid these issues.
Always provide unique titles and descriptions per page. Avoid duplicate metadata. Use openGraph and twitter tags for social sharing. Validate metadata structure to prevent errors. Use dynamic metadata carefully to avoid flickering or mismatches.
Result
Your site ranks better, looks professional in search results, and shares nicely on social media.
Knowing common mistakes helps you avoid SEO traps that silently reduce your site's success.
Under the Hood
Next.js Metadata API works by letting developers export a metadata object or async function from page or layout files. During server-side rendering or static generation, Next.js reads this metadata and injects corresponding HTML meta tags into the document head. This happens before the page is sent to the browser, ensuring crawlers and social platforms see the metadata immediately. The system merges metadata from layouts and pages, resolving conflicts by giving precedence to the most specific metadata. This approach avoids client-side delays and improves SEO performance.
Why designed this way?
The Metadata API was designed to simplify SEO management by moving from manual tag insertion to declarative metadata definitions. This reduces errors, improves maintainability, and fits Next.js's server-first rendering model. Alternatives like client-side metadata updates were slower and less SEO-friendly. The design balances developer experience with SEO best practices, enabling dynamic metadata while ensuring fast server-side rendering.
┌─────────────────────────────┐
│ Page or Layout File         │
│ ┌─────────────────────────┐ │
│ │ export const metadata   │ │
│ │ or generateMetadata()   │ │
│ └─────────────────────────┘ │
└───────────────┬─────────────┘
                │
                ▼
┌─────────────────────────────┐
│ Next.js Server Renderer      │
│ Reads metadata definitions   │
│ Merges layout and page data  │
│ Generates HTML <head> tags   │
└───────────────┬─────────────┘
                │
                ▼
┌─────────────────────────────┐
│ Final HTML Document          │
│ <head> with meta tags       │
│ Sent to browser & crawlers  │
└─────────────────────────────┘
Myth Busters - 4 Common Misconceptions
Quick: Does adding metadata only on the client side give search engines full SEO benefits? Commit yes or no.
Common Belief:Adding metadata with JavaScript on the client side is enough for SEO.
Tap to reveal reality
Reality:Search engines often read metadata from the server-rendered HTML, so client-only metadata can be missed or delayed.
Why it matters:Relying on client-side metadata can cause poor search rankings and incorrect social previews.
Quick: Is it okay to use the same title and description on every page? Commit yes or no.
Common Belief:Using the same metadata on all pages is fine and saves time.
Tap to reveal reality
Reality:Each page should have unique metadata to accurately describe its content for better SEO and user experience.
Why it matters:Duplicate metadata confuses search engines and lowers your site's visibility.
Quick: Can metadata be fully static, or does it always need to be dynamic? Commit your answer.
Common Belief:Metadata must be static and cannot change based on page data.
Tap to reveal reality
Reality:Metadata can be dynamic using async functions, allowing it to reflect real-time or personalized content.
Why it matters:Believing metadata is static limits SEO strategies for dynamic or personalized sites.
Quick: Does metadata defined in a layout file automatically override page metadata? Commit yes or no.
Common Belief:Layout metadata always overrides page-specific metadata.
Tap to reveal reality
Reality:Page metadata overrides layout metadata, allowing specific pages to customize SEO info.
Why it matters:Misunderstanding inheritance can cause unexpected metadata and SEO issues.
Expert Zone
1
Metadata merging respects specificity: page metadata overrides layout metadata, but partial merges happen for nested objects like openGraph.
2
Dynamic metadata functions can cause performance issues if they fetch heavy data; caching strategies are essential.
3
Some metadata fields affect browser behavior (like theme-color), so misuse can impact user experience beyond SEO.
When NOT to use
Avoid using the Metadata API for non-HTML metadata needs like JSON-LD structured data, which should be added separately. For very large dynamic sites with thousands of pages, consider static generation with incremental static regeneration to balance metadata freshness and performance.
Production Patterns
In production, teams use layout-level metadata for site-wide defaults and override metadata per page for unique content. They combine static metadata with dynamic generateMetadata functions for personalized SEO. Metadata validation tools and automated tests ensure consistency. Social media tags like openGraph and twitter are always included for rich sharing previews.
Connections
Semantic HTML
builds-on
Understanding semantic HTML tags like and <meta> helps grasp how metadata improves accessibility and SEO.</span></div></div><div class="dlm-connection-item"><div class="dlm-connection-to">Server-Side Rendering (SSR)</div><div class="dlm-connection-rel">same pattern</div><div class="dlm-connection-insight"><span class="dlm-insight-icon"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="yellow-icon-color" height="22" width="22" xmlns="http://www.w3.org/2000/svg"><path d="M7.94101 18C7.64391 16.7274 6.30412 15.6857 5.75395 14.9992C4.65645 13.6297 4 11.8915 4 10C4 5.58172 7.58172 2 12 2C16.4183 2 20 5.58172 20 10C20 11.8925 19.3428 13.6315 18.2443 15.0014C17.6944 15.687 16.3558 16.7276 16.059 18H7.94101ZM16 20V21C16 22.1046 15.1046 23 14 23H10C8.89543 23 8 22.1046 8 21V20H16ZM13 10.0048V6L8.5 12.0048H11V16.0048L15.5 10.0048H13Z"></path></svg></span><span>Both SSR and Metadata API rely on generating HTML on the server to improve performance and SEO.</span></div></div><div class="dlm-connection-item"><div class="dlm-connection-to">Library Cataloging Systems</div><div class="dlm-connection-rel">similar pattern</div><div class="dlm-connection-insight"><span class="dlm-insight-icon"><svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="yellow-icon-color" height="22" width="22" xmlns="http://www.w3.org/2000/svg"><path d="M7.94101 18C7.64391 16.7274 6.30412 15.6857 5.75395 14.9992C4.65645 13.6297 4 11.8915 4 10C4 5.58172 7.58172 2 12 2C16.4183 2 20 5.58172 20 10C20 11.8925 19.3428 13.6315 18.2443 15.0014C17.6944 15.687 16.3558 16.7276 16.059 18H7.94101ZM16 20V21C16 22.1046 15.1046 23 14 23H10C8.89543 23 8 22.1046 8 21V20H16ZM13 10.0048V6L8.5 12.0048H11V16.0048L15.5 10.0048H13Z"></path></svg></span><span>Just like metadata in SEO describes web pages for search engines, library cataloging metadata describes books for easy discovery, showing how organizing information helps find things faster.</span></div></div></div></div></article><article class="content-card dlm-card"><div class="code-articles-card-header"><span class="card-icon project"><span class="new-material-symbols icon-hw-24"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#EF4444"><path d="m480-513.33 80.67 80.66Q570.33-423 584-423q13.67 0 23.33-9.67Q617-442.33 617-456q0-13.67-9.67-23.33L526.67-560l80.66-80.67Q617-650.33 617-664q0-13.67-9.67-23.33Q597.67-697 584-697q-13.67 0-23.33 9.67L480-606.67l-80.67-80.66Q389.67-697 376-697q-13.67 0-23.33 9.67Q343-677.67 343-664q0 13.67 9.67 23.33L433.33-560l-80.66 80.67Q343-469.67 343-456q0 13.67 9.67 23.33Q362.33-423 376-423q13.67 0 23.33-9.67L480-513.33ZM240-240 136.67-136.67Q121-121 100.5-129.6 80-138.21 80-160.33v-653q0-27 19.83-46.84Q119.67-880 146.67-880h666.66q27 0 46.84 19.83Q880-840.33 880-813.33v506.66q0 27-19.83 46.84Q840.33-240 813.33-240H240Zm-28.67-66.67h602v-506.66H146.67v575l64.66-68.34Zm-64.66 0v-506.66 506.66Z"></path></svg></span></span><span class="codefly-card-title">Common Pitfalls</span></div><div class="code-articles-card-body"><div class="dlm-pitfalls-list"><div class="dlm-pitfall-item"><div class="dlm-pitfall-header"><span class="dlm-pitfall-number">#<!-- -->1</span><span class="dlm-pitfall-title">Using the same title and description for every page.</span></div><div class="dlm-pitfall-body"><div class="dlm-pitfall-wrong"><span class="dlm-pitfall-label"><span class="new-material-symbols icon-hw-20"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#EF4444"><path d="m480-433.33 124.67 124.66Q614.33-299 628-299q13.67 0 23.33-9.67Q661-318.33 661-332q0-13.67-9.67-23.33L526.67-480l124.66-124.67Q661-614.33 661-628q0-13.67-9.67-23.33Q641.67-661 628-661q-13.67 0-23.33 9.67L480-526.67 355.33-651.33Q345.67-661 332-661q-13.67 0-23.33 9.67Q299-641.67 299-628q0 13.67 9.67 23.33L433.33-480 308.67-355.33Q299-345.67 299-332q0 13.67 9.67 23.33Q318.33-299 332-299q13.67 0 23.33-9.67L480-433.33ZM480-80q-82.33 0-155.33-31.5-73-31.5-127.34-85.83Q143-251.67 111.5-324.67T80-480q0-83 31.5-156t85.83-127q54.34-54 127.34-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82.33-31.5 155.33-31.5 73-85.5 127.34Q709-143 636-111.5T480-80Z"></path></svg></span>Wrong approach:</span><span>export const metadata = { title: 'My Website', description: 'Welcome to my website' };</span></div><div class="dlm-pitfall-right"><span class="dlm-pitfall-label"><span class="new-material-symbols icon-hw-20"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#10B981"><path d="m422-395.33-94-94q-9.67-9.67-24-9.67t-24.67 10.33q-9.66 9.67-9.66 24 0 14.34 9.66 24l119.34 120q10 10 23.33 10 13.33 0 23.33-10L680-555.33q10.33-10.34 10.33-24.67 0-14.33-10.33-24.67-10.33-9.66-25-9.33-14.67.33-24.33 10L422-395.33ZM480-80q-82.33 0-155.33-31.5-73-31.5-127.34-85.83Q143-251.67 111.5-324.67T80-480q0-83 31.5-156t85.83-127q54.34-54 127.34-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82.33-31.5 155.33-31.5 73-85.5 127.34Q709-143 636-111.5T480-80Z"></path></svg></span>Correct approach:</span><span>export const metadata = { title: 'Home - My Website', description: 'Welcome to the homepage of my website' };</span></div><div class="dlm-pitfall-root"><span class="dlm-pitfall-label"><span class="new-material-symbols icon-hw-20"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#3B82F6"><path d="M400-320q100 0 170-70t70-170q0-100-70-170t-170-70q-100 0-170 70t-70 170q0 100 70 170t170 70Zm-28.5-131.5Q360-463 360-480v-200q0-17 11.5-28.5T400-720q17 0 28.5 11.5T440-680v200q0 17-11.5 28.5T400-440q-17 0-28.5-11.5Zm-140 0Q220-463 220-480v-120q0-17 11.5-28.5T260-640q17 0 28.5 11.5T300-600v120q0 17-11.5 28.5T260-440q-17 0-28.5-11.5Zm280 0Q500-463 500-480v-80q0-17 11.5-28.5T540-600q17 0 28.5 11.5T580-560v80q0 17-11.5 28.5T540-440q-17 0-28.5-11.5ZM400-240q-134 0-227-93T80-560q0-134 93-227t227-93q134 0 227 93t93 227q0 56-17.5 106T653-363l199 199q11 11 11 28t-11 28q-11 11-28 11t-28-11L597-307q-41 32-91 49.5T400-240Z"></path></svg></span>Root cause:</span><span>Not understanding that unique metadata per page improves SEO and user clarity.</span></div></div></div><div class="dlm-pitfall-item"><div class="dlm-pitfall-header"><span class="dlm-pitfall-number">#<!-- -->2</span><span class="dlm-pitfall-title">Adding metadata only inside client-side effects or components.</span></div><div class="dlm-pitfall-body"><div class="dlm-pitfall-wrong"><span class="dlm-pitfall-label"><span class="new-material-symbols icon-hw-20"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#EF4444"><path d="m480-433.33 124.67 124.66Q614.33-299 628-299q13.67 0 23.33-9.67Q661-318.33 661-332q0-13.67-9.67-23.33L526.67-480l124.66-124.67Q661-614.33 661-628q0-13.67-9.67-23.33Q641.67-661 628-661q-13.67 0-23.33 9.67L480-526.67 355.33-651.33Q345.67-661 332-661q-13.67 0-23.33 9.67Q299-641.67 299-628q0 13.67 9.67 23.33L433.33-480 308.67-355.33Q299-345.67 299-332q0 13.67 9.67 23.33Q318.33-299 332-299q13.67 0 23.33-9.67L480-433.33ZM480-80q-82.33 0-155.33-31.5-73-31.5-127.34-85.83Q143-251.67 111.5-324.67T80-480q0-83 31.5-156t85.83-127q54.34-54 127.34-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82.33-31.5 155.33-31.5 73-85.5 127.34Q709-143 636-111.5T480-80Z"></path></svg></span>Wrong approach:</span><span>useEffect(() => { document.title = 'Page Title'; }, []);</span></div><div class="dlm-pitfall-right"><span class="dlm-pitfall-label"><span class="new-material-symbols icon-hw-20"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#10B981"><path d="m422-395.33-94-94q-9.67-9.67-24-9.67t-24.67 10.33q-9.66 9.67-9.66 24 0 14.34 9.66 24l119.34 120q10 10 23.33 10 13.33 0 23.33-10L680-555.33q10.33-10.34 10.33-24.67 0-14.33-10.33-24.67-10.33-9.66-25-9.33-14.67.33-24.33 10L422-395.33ZM480-80q-82.33 0-155.33-31.5-73-31.5-127.34-85.83Q143-251.67 111.5-324.67T80-480q0-83 31.5-156t85.83-127q54.34-54 127.34-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82.33-31.5 155.33-31.5 73-85.5 127.34Q709-143 636-111.5T480-80Z"></path></svg></span>Correct approach:</span><span>export const metadata = { title: 'Page Title' };</span></div><div class="dlm-pitfall-root"><span class="dlm-pitfall-label"><span class="new-material-symbols icon-hw-20"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#3B82F6"><path d="M400-320q100 0 170-70t70-170q0-100-70-170t-170-70q-100 0-170 70t-70 170q0 100 70 170t170 70Zm-28.5-131.5Q360-463 360-480v-200q0-17 11.5-28.5T400-720q17 0 28.5 11.5T440-680v200q0 17-11.5 28.5T400-440q-17 0-28.5-11.5Zm-140 0Q220-463 220-480v-120q0-17 11.5-28.5T260-640q17 0 28.5 11.5T300-600v120q0 17-11.5 28.5T260-440q-17 0-28.5-11.5Zm280 0Q500-463 500-480v-80q0-17 11.5-28.5T540-600q17 0 28.5 11.5T580-560v80q0 17-11.5 28.5T540-440q-17 0-28.5-11.5ZM400-240q-134 0-227-93T80-560q0-134 93-227t227-93q134 0 227 93t93 227q0 56-17.5 106T653-363l199 199q11 11 11 28t-11 28q-11 11-28 11t-28-11L597-307q-41 32-91 49.5T400-240Z"></path></svg></span>Root cause:</span><span>Believing client-side JavaScript changes are enough for SEO, ignoring server-side rendering.</span></div></div></div><div class="dlm-pitfall-item"><div class="dlm-pitfall-header"><span class="dlm-pitfall-number">#<!-- -->3</span><span class="dlm-pitfall-title">Defining metadata in layout but expecting it to override page metadata.</span></div><div class="dlm-pitfall-body"><div class="dlm-pitfall-wrong"><span class="dlm-pitfall-label"><span class="new-material-symbols icon-hw-20"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#EF4444"><path d="m480-433.33 124.67 124.66Q614.33-299 628-299q13.67 0 23.33-9.67Q661-318.33 661-332q0-13.67-9.67-23.33L526.67-480l124.66-124.67Q661-614.33 661-628q0-13.67-9.67-23.33Q641.67-661 628-661q-13.67 0-23.33 9.67L480-526.67 355.33-651.33Q345.67-661 332-661q-13.67 0-23.33 9.67Q299-641.67 299-628q0 13.67 9.67 23.33L433.33-480 308.67-355.33Q299-345.67 299-332q0 13.67 9.67 23.33Q318.33-299 332-299q13.67 0 23.33-9.67L480-433.33ZM480-80q-82.33 0-155.33-31.5-73-31.5-127.34-85.83Q143-251.67 111.5-324.67T80-480q0-83 31.5-156t85.83-127q54.34-54 127.34-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82.33-31.5 155.33-31.5 73-85.5 127.34Q709-143 636-111.5T480-80Z"></path></svg></span>Wrong approach:</span><span>// layout.js export const metadata = { title: 'Site Title' }; // page.js export const metadata = { title: 'Page Title' }; // expecting layout to override this</span></div><div class="dlm-pitfall-right"><span class="dlm-pitfall-label"><span class="new-material-symbols icon-hw-20"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#10B981"><path d="m422-395.33-94-94q-9.67-9.67-24-9.67t-24.67 10.33q-9.66 9.67-9.66 24 0 14.34 9.66 24l119.34 120q10 10 23.33 10 13.33 0 23.33-10L680-555.33q10.33-10.34 10.33-24.67 0-14.33-10.33-24.67-10.33-9.66-25-9.33-14.67.33-24.33 10L422-395.33ZM480-80q-82.33 0-155.33-31.5-73-31.5-127.34-85.83Q143-251.67 111.5-324.67T80-480q0-83 31.5-156t85.83-127q54.34-54 127.34-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82.33-31.5 155.33-31.5 73-85.5 127.34Q709-143 636-111.5T480-80Z"></path></svg></span>Correct approach:</span><span>// layout.js export const metadata = { title: 'Site Title' }; // page.js export const metadata = { title: 'Page Title' }; // page metadata overrides layout</span></div><div class="dlm-pitfall-root"><span class="dlm-pitfall-label"><span class="new-material-symbols icon-hw-20"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#3B82F6"><path d="M400-320q100 0 170-70t70-170q0-100-70-170t-170-70q-100 0-170 70t-70 170q0 100 70 170t170 70Zm-28.5-131.5Q360-463 360-480v-200q0-17 11.5-28.5T400-720q17 0 28.5 11.5T440-680v200q0 17-11.5 28.5T400-440q-17 0-28.5-11.5Zm-140 0Q220-463 220-480v-120q0-17 11.5-28.5T260-640q17 0 28.5 11.5T300-600v120q0 17-11.5 28.5T260-440q-17 0-28.5-11.5Zm280 0Q500-463 500-480v-80q0-17 11.5-28.5T540-600q17 0 28.5 11.5T580-560v80q0 17-11.5 28.5T540-440q-17 0-28.5-11.5ZM400-240q-134 0-227-93T80-560q0-134 93-227t227-93q134 0 227 93t93 227q0 56-17.5 106T653-363l199 199q11 11 11 28t-11 28q-11 11-28 11t-28-11L597-307q-41 32-91 49.5T400-240Z"></path></svg></span>Root cause:</span><span>Misunderstanding metadata inheritance and override rules.</span></div></div></div></div></div></article><article class="content-card dlm-card"><div class="code-articles-card-header"><span class="card-icon summary"><span class="new-material-symbols icon-hw-24"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#10B981"><path d="M186.67-120q-27.5 0-47.09-19.58Q120-159.17 120-186.67v-586.66q0-27.5 19.58-47.09Q159.17-840 186.67-840h192.66q7.67-35.33 35.84-57.67Q443.33-920 480-920t64.83 22.33Q573-875.33 580.67-840h192.66q27.5 0 47.09 19.58Q840-800.83 840-773.33v586.66q0 27.5-19.58 47.09Q800.83-120 773.33-120H186.67Zm0-66.67h586.66v-586.66H186.67v586.66ZM313.33-280H522q14.17 0 23.75-9.62 9.58-9.61 9.58-23.83 0-14.22-9.58-23.72-9.58-9.5-23.75-9.5H313.33q-14.16 0-23.75 9.62-9.58 9.62-9.58 23.83 0 14.22 9.58 23.72 9.59 9.5 23.75 9.5Zm0-166.67h333.34q14.16 0 23.75-9.61 9.58-9.62 9.58-23.84 0-14.21-9.58-23.71-9.59-9.5-23.75-9.5H313.33q-14.16 0-23.75 9.61-9.58 9.62-9.58 23.84 0 14.21 9.58 23.71 9.59 9.5 23.75 9.5Zm0-166.66h333.34q14.16 0 23.75-9.62 9.58-9.62 9.58-23.83 0-14.22-9.58-23.72-9.59-9.5-23.75-9.5H313.33q-14.16 0-23.75 9.62-9.58 9.61-9.58 23.83 0 14.22 9.58 23.72 9.59 9.5 23.75 9.5ZM503.5-804.5q9.83-9.83 9.83-23.5t-9.83-23.5q-9.83-9.83-23.5-9.83t-23.5 9.83q-9.83 9.83-9.83 23.5t9.83 23.5q9.83 9.83 23.5 9.83t23.5-9.83ZM186.67-186.67v-586.66 586.66Z"></path></svg></span></span><span class="codefly-card-title">Key Takeaways</span></div><div class="code-articles-card-body"><div class="summary-list"><div class="summary-item"><span class="new-material-symbols icon-hw-26"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#10B981"><path d="m422-395.33-94-94q-9.67-9.67-24-9.67t-24.67 10.33q-9.66 9.67-9.66 24 0 14.34 9.66 24l119.34 120q10 10 23.33 10 13.33 0 23.33-10L680-555.33q10.33-10.34 10.33-24.67 0-14.33-10.33-24.67-10.33-9.66-25-9.33-14.67.33-24.33 10L422-395.33ZM480-80q-82.33 0-155.33-31.5-73-31.5-127.34-85.83Q143-251.67 111.5-324.67T80-480q0-83 31.5-156t85.83-127q54.34-54 127.34-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82.33-31.5 155.33-31.5 73-85.5 127.34Q709-143 636-111.5T480-80Z"></path></svg></span><span class="summary-text">The Metadata API in Next.js lets you add SEO and social sharing info declaratively inside your components.</span></div><div class="summary-item"><span class="new-material-symbols icon-hw-26"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#10B981"><path d="m422-395.33-94-94q-9.67-9.67-24-9.67t-24.67 10.33q-9.66 9.67-9.66 24 0 14.34 9.66 24l119.34 120q10 10 23.33 10 13.33 0 23.33-10L680-555.33q10.33-10.34 10.33-24.67 0-14.33-10.33-24.67-10.33-9.66-25-9.33-14.67.33-24.33 10L422-395.33ZM480-80q-82.33 0-155.33-31.5-73-31.5-127.34-85.83Q143-251.67 111.5-324.67T80-480q0-83 31.5-156t85.83-127q54.34-54 127.34-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82.33-31.5 155.33-31.5 73-85.5 127.34Q709-143 636-111.5T480-80Z"></path></svg></span><span class="summary-text">Metadata is rendered on the server, ensuring search engines and social platforms see it immediately for better ranking and previews.</span></div><div class="summary-item"><span class="new-material-symbols icon-hw-26"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#10B981"><path d="m422-395.33-94-94q-9.67-9.67-24-9.67t-24.67 10.33q-9.66 9.67-9.66 24 0 14.34 9.66 24l119.34 120q10 10 23.33 10 13.33 0 23.33-10L680-555.33q10.33-10.34 10.33-24.67 0-14.33-10.33-24.67-10.33-9.66-25-9.33-14.67.33-24.33 10L422-395.33ZM480-80q-82.33 0-155.33-31.5-73-31.5-127.34-85.83Q143-251.67 111.5-324.67T80-480q0-83 31.5-156t85.83-127q54.34-54 127.34-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82.33-31.5 155.33-31.5 73-85.5 127.34Q709-143 636-111.5T480-80Z"></path></svg></span><span class="summary-text">Unique and accurate metadata per page improves search visibility and user experience significantly.</span></div><div class="summary-item"><span class="new-material-symbols icon-hw-26"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#10B981"><path d="m422-395.33-94-94q-9.67-9.67-24-9.67t-24.67 10.33q-9.66 9.67-9.66 24 0 14.34 9.66 24l119.34 120q10 10 23.33 10 13.33 0 23.33-10L680-555.33q10.33-10.34 10.33-24.67 0-14.33-10.33-24.67-10.33-9.66-25-9.33-14.67.33-24.33 10L422-395.33ZM480-80q-82.33 0-155.33-31.5-73-31.5-127.34-85.83Q143-251.67 111.5-324.67T80-480q0-83 31.5-156t85.83-127q54.34-54 127.34-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82.33-31.5 155.33-31.5 73-85.5 127.34Q709-143 636-111.5T480-80Z"></path></svg></span><span class="summary-text">Layouts provide shared metadata that child pages inherit but can override for customization.</span></div><div class="summary-item"><span class="new-material-symbols icon-hw-26"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#10B981"><path d="m422-395.33-94-94q-9.67-9.67-24-9.67t-24.67 10.33q-9.66 9.67-9.66 24 0 14.34 9.66 24l119.34 120q10 10 23.33 10 13.33 0 23.33-10L680-555.33q10.33-10.34 10.33-24.67 0-14.33-10.33-24.67-10.33-9.66-25-9.33-14.67.33-24.33 10L422-395.33ZM480-80q-82.33 0-155.33-31.5-73-31.5-127.34-85.83Q143-251.67 111.5-324.67T80-480q0-83 31.5-156t85.83-127q54.34-54 127.34-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82.33-31.5 155.33-31.5 73-85.5 127.34Q709-143 636-111.5T480-80Z"></path></svg></span><span class="summary-text">Dynamic metadata functions enable real-time SEO updates but require careful performance management.</span></div></div></div></article></div></div></main><div style="position:fixed;bottom:24px;right:24px;z-index:50"><button style="background:rgba(255,255,255,0.95);border:1px solid rgba(108,99,255,0.18);border-radius:10px;padding:10px 16px;color:#5f56fe;font-size:14px;cursor:pointer;display:flex;align-items:center;gap:7px;backdrop-filter:blur(12px);box-shadow:0 2px 12px rgba(0,0,0,0.08), 0 0 0 1px rgba(108,99,255,0.06);transition:all 0.2s"><span style="font-size:14px">⚑</span>Report Issue</button></div></div> <script src="/_next/static/chunks/webpack-fd24bd8e19d2841a.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/css/b133bdac07c7940e.css\",\"style\"]\n2:HL[\"/_next/static/css/837a603cb1a59856.css\",\"style\"]\n3:HL[\"/_next/static/css/725c7861d1898ba8.css\",\"style\"]\n4:HL[\"/_next/static/css/caf3ca742c7945f9.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"5:I[95751,[],\"\"]\n8:I[39275,[],\"\"]\ne:I[61343,[],\"\"]\nf:I[84080,[\"8726\",\"static/chunks/8726-583188341cbc1496.js\",\"3185\",\"static/chunks/app/layout-7a1373330f6a4c98.js\"],\"\"]\n10:I[88726,[\"8726\",\"static/chunks/8726-583188341cbc1496.js\",\"3185\",\"static/chunks/app/layout-7a1373330f6a4c98.js\"],\"Toaster\"]\n11:I[20154,[\"8422\",\"static/chunks/66ec4792-a0fc378024be0c7b.js\",\"6648\",\"static/chunks/6648-fff0cf0e0a1f8d25.js\",\"9160\",\"static/chunks/app/not-found-c4181ddc3e64e5f3.js\"],\"default\"]\n12:I[70548,[\"8726\",\"static/chunks/8726-583188341cbc1496.js\",\"3185\",\"static/chunks/app/layout-7a1373330f6a4c98.js\"],\"default\"]\n14:I[76130,[],\"\"]\n9:[\"lang\",\"en\",\"d\"]\na:[\"subject\",\"nextjs\",\"d\"]\nb:[\"part\",\"part-1\",\"d\"]\nc:[\"pattern\",\"nextjs-metadata-api-for-seo\",\"d\"]\nd:[\"mode\",\"deep\",\"oc\"]\n15:[]\n"])</script><script>self.__next_f.push([1,"0:[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/b133bdac07c7940e.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"$L5\",null,{\"buildId\":\"hN8t5By7h5nzsrdSose07\",\"assetPrefix\":\"\",\"initialCanonicalUrl\":\"/en/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo/deep\",\"initialTree\":[\"\",{\"children\":[[\"lang\",\"en\",\"d\"],{\"children\":[\"codefly\",{\"children\":[\"learn\",{\"children\":[[\"subject\",\"nextjs\",\"d\"],{\"children\":[[\"part\",\"part-1\",\"d\"],{\"children\":[[\"pattern\",\"nextjs-metadata-api-for-seo\",\"d\"],{\"children\":[[\"mode\",\"deep\",\"oc\"],{\"children\":[\"__PAGE__\",{}]}]}]}]}]}]}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[[\"lang\",\"en\",\"d\"],{\"children\":[\"codefly\",{\"children\":[\"learn\",{\"children\":[[\"subject\",\"nextjs\",\"d\"],{\"children\":[[\"part\",\"part-1\",\"d\"],{\"children\":[[\"pattern\",\"nextjs-metadata-api-for-seo\",\"d\"],{\"children\":[[\"mode\",\"deep\",\"oc\"],{\"children\":[\"__PAGE__\",{},[[\"$L6\",\"$L7\"],null],null]},[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$9\",\"children\",\"codefly\",\"children\",\"learn\",\"children\",\"$a\",\"children\",\"$b\",\"children\",\"$c\",\"children\",\"$d\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/837a603cb1a59856.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/725c7861d1898ba8.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"2\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/caf3ca742c7945f9.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]]}],null]},[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$9\",\"children\",\"codefly\",\"children\",\"learn\",\"children\",\"$a\",\"children\",\"$b\",\"children\",\"$c\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$9\",\"children\",\"codefly\",\"children\",\"learn\",\"children\",\"$a\",\"children\",\"$b\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$9\",\"children\",\"codefly\",\"children\",\"learn\",\"children\",\"$a\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$9\",\"children\",\"codefly\",\"children\",\"learn\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$9\",\"children\",\"codefly\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"$9\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"meta\",null,{\"name\":\"theme-color\",\"content\":\"#5f56fe\"}],[\"$\",\"meta\",null,{\"name\":\"msapplication-TileColor\",\"content\":\"#5f56fe\"}],[\"$\",\"$Lf\",null,{\"src\":\"https://www.googletagmanager.com/gtag/js?id=G-N2NY2DMMDW\",\"strategy\":\"afterInteractive\"}],[\"$\",\"$Lf\",null,{\"id\":\"google-analytics\",\"strategy\":\"afterInteractive\",\"children\":\"\\n window.dataLayer = window.dataLayer || [];\\n function gtag(){dataLayer.push(arguments);}\\n gtag('js', new Date());\\n gtag('config', 'G-N2NY2DMMDW', {\\n page_path: window.location.pathname,\\n });\\n \"}],[\"$\",\"script\",null,{\"async\":true,\"src\":\"https://www.googletagmanager.com/gtag/js?id=AW-17928224938\"}],[\"$\",\"$Lf\",null,{\"children\":\"\\n window.dataLayer = window.dataLayer || [];\\n function gtag() {\\n dataLayer.push(arguments);\\n }\\n gtag('js', new Date());\\n gtag('config', 'AW-17928224938');\\n \"}],[\"$\",\"script\",null,{\"data-grow-initializer\":\"\",\"suppressHydrationWarning\":true,\"dangerouslySetInnerHTML\":{\"__html\":\"!(function(){window.growMe||((window.growMe=function(e){window.growMe._.push(e);}),(window.growMe._=[]));var e=document.createElement(\\\"script\\\");(e.type=\\\"text/javascript\\\"),(e.src=\\\"https://faves.grow.me/main.js\\\"),(e.defer=!0),e.setAttribute(\\\"data-grow-faves-site-id\\\",\\\"U2l0ZTo0MGIxZDBlZC0wNzdlLTQ0NjgtOThmOC1kNDYyZGMwM2IwMWY=\\\");var t=document.getElementsByTagName(\\\"script\\\")[0];t.parentNode.insertBefore(e,t);})();\"}}],[\"$\",\"$Lf\",null,{\"src\":\"//scripts.scriptwrapper.com/tags/40b1d0ed-077e-4468-98f8-d462dc03b01f.js\",\"strategy\":\"afterInteractive\",\"data-noptimize\":\"1\",\"data-cfasync\":\"false\"}],[\"$\",\"script\",null,{\"type\":\"application/ld+json\",\"suppressHydrationWarning\":true,\"dangerouslySetInnerHTML\":{\"__html\":\"{\\\"@context\\\":\\\"https://schema.org\\\",\\\"@type\\\":\\\"WebApplication\\\",\\\"name\\\":\\\"Leyaa.ai\\\",\\\"description\\\":\\\"Leyaa.ai builds learning intelligence that understands how you learn - guiding what to study, how to practice, and when to move forward.\\\",\\\"url\\\":\\\"https://leyaa.ai\\\",\\\"applicationCategory\\\":\\\"EducationalApplication\\\",\\\"operatingSystem\\\":\\\"Web\\\",\\\"offers\\\":{\\\"@type\\\":\\\"Offer\\\",\\\"price\\\":\\\"0\\\",\\\"priceCurrency\\\":\\\"USD\\\"},\\\"creator\\\":{\\\"@type\\\":\\\"Organization\\\",\\\"name\\\":\\\"Leyaa.ai\\\"}}\"}}],[\"$\",\"link\",null,{\"href\":\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css\",\"rel\":\"stylesheet\",\"integrity\":\"sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB\",\"crossOrigin\":\"anonymous\"}],[\"$\",\"$Lf\",null,{\"id\":\"clarity-script\",\"strategy\":\"afterInteractive\",\"dangerouslySetInnerHTML\":{\"__html\":\"\\n (function(c,l,a,r,i,t,y){\\n c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};\\n t=l.createElement(r);t.async=1;t.src=\\\"https://www.clarity.ms/tag/\\\"+i;\\n y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);\\n })(window, document, \\\"clarity\\\", \\\"script\\\", \\\"w4gxh6rdmh\\\");\\n \"}}]]}],[\"$\",\"body\",null,{\"children\":[[\"$\",\"$L10\",null,{\"containerStyle\":{\"top\":70}}],[\"$\",\"div\",null,{\"className\":\"bg-grid\"}],[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[\"$\",\"$L11\",null,{}],\"notFoundStyles\":[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/250d3fff07338fa3.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],\"styles\":null}],[\"$\",\"$L12\",null,{}],\" \"]}]]}],null],null],\"couldBeIntercepted\":false,\"initialHead\":[false,\"$L13\"],\"globalErrorComponent\":\"$14\",\"missingSlots\":\"$W15\"}]]\n"])</script><script>self.__next_f.push([1,"16:I[51766,[\"8422\",\"static/chunks/66ec4792-a0fc378024be0c7b.js\",\"522\",\"static/chunks/94730671-fd9628eddbd5107b.js\",\"7240\",\"static/chunks/53c13509-506edbde2b5b3f55.js\",\"7699\",\"static/chunks/8e1d74a4-a085c2fbc868135a.js\",\"5706\",\"static/chunks/9c4e2130-11ecd4bfc78e4568.js\",\"1779\",\"static/chunks/0e762574-6b3bda54d2fd2e14.js\",\"6648\",\"static/chunks/6648-fff0cf0e0a1f8d25.js\",\"3463\",\"static/chunks/3463-09ee572e3d7819a2.js\",\"4889\",\"static/chunks/4889-956a916919971629.js\",\"9985\",\"static/chunks/9985-b39235669d2563e2.js\",\"7627\",\"static/chunks/7627-224bb765a4decf1d.js\",\"7652\",\"static/chunks/7652-412e201fe52797ee.js\",\"8935\",\"static/chunks/8935-c1c159349bf7da40.js\",\"9663\",\"static/chunks/9663-fdcd080af3916e3e.js\",\"7029\",\"static/chunks/app/%5Blang%5D/codefly/learn/%5Bsubject%5D/%5Bpart%5D/%5Bpattern%5D/%5B%5B...mode%5D%5D/page-1fc9c577a9450e06.js\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"7:[[[\"$\",\"script\",\"0\",{\"type\":\"application/ld+json\",\"dangerouslySetInnerHTML\":{\"__html\":\"{\\\"@context\\\":\\\"https://schema.org\\\",\\\"@type\\\":\\\"LearningResource\\\",\\\"name\\\":\\\"Metadata API for SEO in NextJS - Deep Dive\\\",\\\"description\\\":\\\"Go deep on Metadata API for SEO in NextJS. Internals, mental models, under-the-hood mechanics, misconceptions, common pitfalls, and production patterns. For serious learners.\\\",\\\"url\\\":\\\"https://leyaa.ai/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo\\\",\\\"learningResourceType\\\":\\\"Tutorial\\\",\\\"programmingLanguage\\\":\\\"NextJS\\\",\\\"inLanguage\\\":\\\"en\\\",\\\"isAccessibleForFree\\\":true,\\\"teaches\\\":\\\"Metadata API for SEO in NextJS - Deep Dive\\\",\\\"provider\\\":{\\\"@type\\\":\\\"Organization\\\",\\\"url\\\":\\\"https://leyaa.ai\\\"},\\\"educationalLevel\\\":\\\"Beginner to Advanced\\\",\\\"breadcrumb\\\":{\\\"@type\\\":\\\"BreadcrumbList\\\",\\\"itemListElement\\\":[{\\\"@type\\\":\\\"ListItem\\\",\\\"position\\\":1,\\\"name\\\":\\\"Home\\\",\\\"item\\\":\\\"https://leyaa.ai\\\"},{\\\"@type\\\":\\\"ListItem\\\",\\\"position\\\":2,\\\"name\\\":\\\"Metadata API for SEO in NextJS - Deep Dive\\\",\\\"item\\\":\\\"https://leyaa.ai/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo\\\"}]}}\"}}]],[\"$\",\"$L16\",null,{\"subject\":\"nextjs\",\"dbSubject\":\"nextjs\",\"part\":\"part-1\",\"pattern\":\"nextjs_metadata_api_for_seo\",\"modeSlug\":\"deep\",\"lang\":\"en\",\"internalLinks\":[{\"code\":\"LMC\",\"slug\":\"\",\"label\":\"📖 Learn\",\"href\":\"/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo\",\"active\":false},{\"code\":\"LMCWHY\",\"slug\":\"why\",\"label\":\"💡 Why Learn This\",\"href\":\"/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo/why\",\"active\":false},{\"code\":\"DLM\",\"slug\":\"deep\",\"label\":\"💡 Deep Learn Mode\",\"href\":\"/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo/deep\",\"active\":true},{\"code\":\"TMC\",\"slug\":\"try\",\"label\":\"✏️ Try It\",\"href\":\"/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo/try\",\"active\":false},{\"code\":\"VMC\",\"slug\":\"visualize\",\"label\":\"👁 Visualize\",\"href\":\"/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo/visualize\",\"active\":false},{\"code\":\"TCM\",\"slug\":\"complexity\",\"label\":\"⏱ Complexity\",\"href\":\"/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo/complexity\",\"active\":false},{\"code\":\"CMC\",\"slug\":\"challenge\",\"label\":\"🏆 Challenge\",\"href\":\"/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo/challenge\",\"active\":false},{\"code\":\"PMC\",\"slug\":\"project\",\"label\":\"📁 Project\",\"href\":\"/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo/project\",\"active\":false},{\"code\":\"RMC\",\"slug\":\"review\",\"label\":\"🧠 Quick Review\",\"href\":\"/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo/review\",\"active\":false}],\"isLoggedIn\":false,\"seoH1\":\"Metadata API for SEO in NextJS - Deep Dive\",\"contentData\":{\"pattern_id\":\"nextjs_metadata_api_for_seo\",\"metadata\":{\"slot_map\":{\"LMCWHY\":\"LMCWHY\",\"LMC\":\"LMC\",\"TMC\":\"TMC\",\"CMC\":\"CMC\",\"RMC\":\"RMC\",\"VMC\":\"VMC\",\"TCM\":\"WPM\",\"PMC\":\"PMC\",\"DLM\":\"DLM\"}},\"modes\":{\"DLM\":{\"topic\":\"Metadata API for SEO\",\"mode\":\"DLM_v1\",\"language\":\"nextjs\",\"content_type\":\"Frameworks \u0026 Libraries\",\"overview\":{\"what\":\"The Metadata API in Next.js is a way to add information about your web pages that search engines and social media platforms use to understand and display your site better. This information includes titles, descriptions, keywords, and social sharing details. It helps your pages show up nicely in search results and when shared on social media. You add this metadata directly in your Next.js components using a simple, structured approach.\",\"why_it_matters\":\"Without proper metadata, your website might not appear clearly or attractively in search engines or social media previews. This can reduce visitors and hurt your site's visibility. The Metadata API solves this by making it easy to add and manage SEO-related information, improving how your site is found and shared. It helps your website stand out and reach more people, which is crucial for success online.\",\"where_it_fits\":\"Before learning the Metadata API, you should understand basic Next.js concepts like pages, components, and routing. Knowing HTML basics, especially the head element and meta tags, helps too. After mastering this, you can explore advanced SEO techniques, dynamic metadata, and performance optimization in Next.js.\"},\"mental_model\":{\"core_idea\":\"The Metadata API lets you tell search engines and social platforms what your page is about by adding special information inside your Next.js components.\",\"analogy\":\"It's like putting a label on a gift box that tells the delivery person what's inside and how to handle it, so it reaches the right person looking nice.\",\"visual\":\"┌─────────────────────────────┐\\n│ Next.js Page Component │\\n│ ┌─────────────────────────┐ │\\n│ │ Metadata API Section │ │\\n│ │ ┌─────────────────────┐ │ │\\n│ │ │ \u003ctitle\u003e, \u003cmeta\u003e tags │ │ │\\n│ │ └─────────────────────┘ │ │\\n│ └─────────────────────────┘ │\\n└─────────────────────────────┘\\n ↓\\n┌─────────────────────────────┐\\n│ HTML Document Head │\\n│ ┌─────────────────────────┐ │\\n│ │ \u003ctitle\u003e, \u003cmeta\u003e tags │ │\\n│ └─────────────────────────┘ │\\n└─────────────────────────────┘\\n ↓\\n┌─────────────────────────────┐\\n│ Search Engines \u0026 Social │\\n│ Platforms Read Metadata │\\n└─────────────────────────────┘\"},\"build_up\":[{\"level\":\"foundation\",\"title\":\"What is Metadata in Web Pages\",\"concept\":\"Metadata is information about a web page that is not shown directly on the page but helps search engines and browsers understand it.\",\"content\":\"Web pages have a special section called the head where metadata lives. This includes the page title, description, and keywords. These help search engines know what the page is about and how to show it in search results.\",\"result\":\"You understand that metadata is separate from visible content but important for search and sharing.\",\"insight\":\"Knowing that metadata is hidden but powerful helps you see why it needs special handling in web frameworks.\"},{\"level\":\"foundation\",\"title\":\"How Next.js Handles Page Metadata\",\"concept\":\"Next.js uses a special component to add metadata inside your page components, making it easy to manage SEO info.\",\"content\":\"In Next.js, you can use the built-in Head component to add metadata tags inside your page or layout components. This Head component ensures metadata is added to the HTML head section when the page loads.\",\"result\":\"You can add titles and meta tags in your Next.js pages that appear correctly in the browser and search engines.\",\"insight\":\"Understanding that Next.js abstracts metadata insertion lets you focus on content, not HTML details.\"},{\"level\":\"intermediate\",\"title\":\"Using the Metadata API in Next.js 13+\",\"self_check\":\"Before reading on: do you think metadata is added by manually editing HTML files or by code inside components? Commit to your answer.\",\"concept\":\"Next.js 13 introduced a Metadata API that lets you define metadata as an object or function in your page or layout files, simplifying SEO management.\",\"content\":\"Instead of manually writing \u003cHead\u003e tags, you export a metadata object from your page or layout file. This object includes title, description, openGraph, twitter, and other SEO properties. Next.js automatically converts this into proper meta tags.\",\"result\":\"Your metadata is cleaner, easier to maintain, and automatically handled by Next.js during rendering.\",\"insight\":\"Knowing metadata can be defined declaratively as data rather than markup reduces errors and improves consistency.\"},{\"level\":\"intermediate\",\"title\":\"Dynamic Metadata with Async Functions\",\"self_check\":\"Before reading on: can metadata in Next.js be static only, or can it change based on data? Commit to your answer.\",\"concept\":\"Metadata can be generated dynamically using async functions, allowing SEO info to reflect real-time data or user input.\",\"content\":\"You can export an async function called generateMetadata that fetches data (like from an API) and returns a metadata object. This lets your page metadata update based on content or user context.\",\"result\":\"Your pages have SEO metadata that matches the actual content dynamically, improving relevance and search ranking.\",\"insight\":\"Understanding dynamic metadata unlocks powerful SEO strategies for personalized or frequently updated content.\"},{\"level\":\"advanced\",\"title\":\"Metadata Inheritance and Layouts\",\"self_check\":\"Before reading on: do you think metadata defined in layouts affects child pages automatically? Commit to your answer.\",\"concept\":\"Metadata defined in layout files applies to all nested pages, allowing shared SEO info and overrides for specific pages.\",\"content\":\"Next.js lets you define metadata in layout.js files. Child pages inherit this metadata unless they override it. This helps keep consistent titles, descriptions, and social tags across sections of your site.\",\"result\":\"You can manage SEO metadata efficiently across large sites with shared layouts and page-specific overrides.\",\"insight\":\"Knowing metadata inheritance prevents duplication and keeps SEO consistent across your app.\"},{\"level\":\"expert\",\"title\":\"How Next.js Renders Metadata for SEO\",\"self_check\":\"Before reading on: do you think metadata is added only on the client side or also on the server side? Commit to your answer.\",\"concept\":\"Next.js renders metadata on the server during page generation, ensuring search engines see the correct metadata immediately.\",\"content\":\"When you use the Metadata API, Next.js generates the meta tags during server-side rendering or static generation. This means crawlers and social platforms get the metadata without waiting for JavaScript to run, improving SEO and performance.\",\"result\":\"Your pages have fast, SEO-friendly metadata visible to search engines and social previews right away.\",\"insight\":\"Understanding server-side metadata rendering explains why Next.js SEO works better than client-only approaches.\"},{\"level\":\"expert\",\"title\":\"Common Pitfalls and Best Practices\",\"self_check\":\"Before reading on: do you think missing metadata breaks your site or just reduces SEO quality? Commit to your answer.\",\"concept\":\"Missing or incorrect metadata doesn't break your site but can hurt SEO and user experience; best practices help avoid these issues.\",\"content\":\"Always provide unique titles and descriptions per page. Avoid duplicate metadata. Use openGraph and twitter tags for social sharing. Validate metadata structure to prevent errors. Use dynamic metadata carefully to avoid flickering or mismatches.\",\"result\":\"Your site ranks better, looks professional in search results, and shares nicely on social media.\",\"insight\":\"Knowing common mistakes helps you avoid SEO traps that silently reduce your site's success.\"}],\"under_the_hood\":{\"mechanism\":\"Next.js Metadata API works by letting developers export a metadata object or async function from page or layout files. During server-side rendering or static generation, Next.js reads this metadata and injects corresponding HTML meta tags into the document head. This happens before the page is sent to the browser, ensuring crawlers and social platforms see the metadata immediately. The system merges metadata from layouts and pages, resolving conflicts by giving precedence to the most specific metadata. This approach avoids client-side delays and improves SEO performance.\",\"why_designed_this_way\":\"The Metadata API was designed to simplify SEO management by moving from manual \u003cHead\u003e tag insertion to declarative metadata definitions. This reduces errors, improves maintainability, and fits Next.js's server-first rendering model. Alternatives like client-side metadata updates were slower and less SEO-friendly. The design balances developer experience with SEO best practices, enabling dynamic metadata while ensuring fast server-side rendering.\",\"diagram\":\"┌─────────────────────────────┐\\n│ Page or Layout File │\\n│ ┌─────────────────────────┐ │\\n│ │ export const metadata │ │\\n│ │ or generateMetadata() │ │\\n│ └─────────────────────────┘ │\\n└───────────────┬─────────────┘\\n │\\n ▼\\n┌─────────────────────────────┐\\n│ Next.js Server Renderer │\\n│ Reads metadata definitions │\\n│ Merges layout and page data │\\n│ Generates HTML \u003chead\u003e tags │\\n└───────────────┬─────────────┘\\n │\\n ▼\\n┌─────────────────────────────┐\\n│ Final HTML Document │\\n│ \u003chead\u003e with meta tags │\\n│ Sent to browser \u0026 crawlers │\\n└─────────────────────────────┘\"},\"misconceptions\":[{\"self_check\":\"Quick: Does adding metadata only on the client side give search engines full SEO benefits? Commit yes or no.\",\"belief\":\"Adding metadata with JavaScript on the client side is enough for SEO.\",\"reality\":\"Search engines often read metadata from the server-rendered HTML, so client-only metadata can be missed or delayed.\",\"why_it_matters\":\"Relying on client-side metadata can cause poor search rankings and incorrect social previews.\"},{\"self_check\":\"Quick: Is it okay to use the same title and description on every page? Commit yes or no.\",\"belief\":\"Using the same metadata on all pages is fine and saves time.\",\"reality\":\"Each page should have unique metadata to accurately describe its content for better SEO and user experience.\",\"why_it_matters\":\"Duplicate metadata confuses search engines and lowers your site's visibility.\"},{\"self_check\":\"Quick: Can metadata be fully static, or does it always need to be dynamic? Commit your answer.\",\"belief\":\"Metadata must be static and cannot change based on page data.\",\"reality\":\"Metadata can be dynamic using async functions, allowing it to reflect real-time or personalized content.\",\"why_it_matters\":\"Believing metadata is static limits SEO strategies for dynamic or personalized sites.\"},{\"self_check\":\"Quick: Does metadata defined in a layout file automatically override page metadata? Commit yes or no.\",\"belief\":\"Layout metadata always overrides page-specific metadata.\",\"reality\":\"Page metadata overrides layout metadata, allowing specific pages to customize SEO info.\",\"why_it_matters\":\"Misunderstanding inheritance can cause unexpected metadata and SEO issues.\"}],\"expert_zone\":{\"nuances\":[\"Metadata merging respects specificity: page metadata overrides layout metadata, but partial merges happen for nested objects like openGraph.\",\"Dynamic metadata functions can cause performance issues if they fetch heavy data; caching strategies are essential.\",\"Some metadata fields affect browser behavior (like theme-color), so misuse can impact user experience beyond SEO.\"],\"when_not_to_use\":\"Avoid using the Metadata API for non-HTML metadata needs like JSON-LD structured data, which should be added separately. For very large dynamic sites with thousands of pages, consider static generation with incremental static regeneration to balance metadata freshness and performance.\",\"production_patterns\":\"In production, teams use layout-level metadata for site-wide defaults and override metadata per page for unique content. They combine static metadata with dynamic generateMetadata functions for personalized SEO. Metadata validation tools and automated tests ensure consistency. Social media tags like openGraph and twitter are always included for rich sharing previews.\"},\"connections\":[{\"to_concept\":\"Semantic HTML\",\"relationship\":\"builds-on\",\"insight\":\"Understanding semantic HTML tags like \u003ctitle\u003e and \u003cmeta\u003e helps grasp how metadata improves accessibility and SEO.\"},{\"to_concept\":\"Server-Side Rendering (SSR)\",\"relationship\":\"same pattern\",\"insight\":\"Both SSR and Metadata API rely on generating HTML on the server to improve performance and SEO.\"},{\"to_concept\":\"Library Cataloging Systems\",\"relationship\":\"similar pattern\",\"insight\":\"Just like metadata in SEO describes web pages for search engines, library cataloging metadata describes books for easy discovery, showing how organizing information helps find things faster.\"}],\"pitfalls\":[{\"mistake\":\"Using the same title and description for every page.\",\"incorrect_approach\":\"export const metadata = {\\n title: 'My Website',\\n description: 'Welcome to my website'\\n};\",\"correct_approach\":\"export const metadata = {\\n title: 'Home - My Website',\\n description: 'Welcome to the homepage of my website'\\n};\",\"root_cause\":\"Not understanding that unique metadata per page improves SEO and user clarity.\"},{\"mistake\":\"Adding metadata only inside client-side effects or components.\",\"incorrect_approach\":\"useEffect(() =\u003e {\\n document.title = 'Page Title';\\n}, []);\",\"correct_approach\":\"export const metadata = {\\n title: 'Page Title'\\n};\",\"root_cause\":\"Believing client-side JavaScript changes are enough for SEO, ignoring server-side rendering.\"},{\"mistake\":\"Defining metadata in layout but expecting it to override page metadata.\",\"incorrect_approach\":\"// layout.js\\nexport const metadata = {\\n title: 'Site Title'\\n};\\n\\n// page.js\\nexport const metadata = {\\n title: 'Page Title'\\n}; // expecting layout to override this\",\"correct_approach\":\"// layout.js\\nexport const metadata = {\\n title: 'Site Title'\\n};\\n\\n// page.js\\nexport const metadata = {\\n title: 'Page Title'\\n}; // page metadata overrides layout\",\"root_cause\":\"Misunderstanding metadata inheritance and override rules.\"}],\"key_takeaways\":[\"The Metadata API in Next.js lets you add SEO and social sharing info declaratively inside your components.\",\"Metadata is rendered on the server, ensuring search engines and social platforms see it immediately for better ranking and previews.\",\"Unique and accurate metadata per page improves search visibility and user experience significantly.\",\"Layouts provide shared metadata that child pages inherit but can override for customization.\",\"Dynamic metadata functions enable real-time SEO updates but require careful performance management.\"],\"metadata\":{\"version\":\"1.0\",\"content_type\":\"framework\",\"estimated_time_minutes\":15,\"depth_level\":\"comprehensive\",\"difficulty_ceiling\":\"expert\"}}},\"subject\":\"nextjs\",\"title\":\"Metadata API for SEO\"},\"syllabusData\":{\"part\":\"part-1\",\"subject\":\"nextjs\",\"difficulty\":\"beginner\",\"metadata\":{\"total_topics\":8,\"total_patterns\":65,\"patterns_with_content\":65,\"created_at\":\"2026-02-28T20:17:25.344558Z\",\"version\":\"4.2\",\"upload_tool\":\"upload_to_mongo.py v2.0\"},\"part_title\":\"Foundations\",\"subjectTitle\":\"NextJS\",\"topics\":[{\"topic_id\":\"nextjs_p1_t1\",\"title\":\"Next.js Basics\",\"order\":1,\"pattern_count\":8,\"patterns\":[{\"pattern_id\":\"nextjs_what_is_nextjs\",\"title\":\"What is Next.js\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"nextjs_why_nextjs_over_plain_react\",\"title\":\"Why Next.js over plain React\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"nextjs_how_nextjs_renders_serverfirst_model\",\"title\":\"How Next.js renders (server-first model)\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"nextjs_create_next_app_setup\",\"title\":\"Create Next App setup\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"nextjs_project_structure_overview\",\"title\":\"Project structure overview\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"nextjs_app_directory_app_router\",\"title\":\"App directory (App Router)\",\"order\":6,\"has_content\":true},{\"pattern_id\":\"nextjs_development_server_and_hot_reload\",\"title\":\"Development server and hot reload\",\"order\":7,\"has_content\":true},{\"pattern_id\":\"nextjs_typescript_support_in_nextjs\",\"title\":\"TypeScript support in Next.js\",\"order\":8,\"has_content\":true}]},{\"topic_id\":\"nextjs_p1_t2\",\"title\":\"File-Based Routing\",\"order\":2,\"pattern_count\":9,\"patterns\":[{\"pattern_id\":\"nextjs_why_filebased_routing_simplifies_navigation\",\"title\":\"Why file-based routing simplifies navigation\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"nextjs_pagetsx_as_route_definition\",\"title\":\"Page.tsx as route definition\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"nextjs_nested_routes_with_folders\",\"title\":\"Nested routes with folders\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"nextjs_dynamic_routes_with_param\",\"title\":\"Dynamic routes with [param]\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"nextjs_catchall_routes_with_param\",\"title\":\"Catch-all routes with [...param]\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"nextjs_route_groups_with_groupname\",\"title\":\"Route groups with (groupName)\",\"order\":6,\"has_content\":true},{\"pattern_id\":\"nextjs_notfound_page_handling\",\"title\":\"Not-found page handling\",\"order\":7,\"has_content\":true},{\"pattern_id\":\"nextjs_loading_ui_with_loadingtsx\",\"title\":\"Loading UI with loading.tsx\",\"order\":8,\"has_content\":true},{\"pattern_id\":\"nextjs_error_handling_with_errortsx\",\"title\":\"Error handling with error.tsx\",\"order\":9,\"has_content\":true}]},{\"topic_id\":\"nextjs_p1_t3\",\"title\":\"Layouts and Templates\",\"order\":3,\"pattern_count\":8,\"patterns\":[{\"pattern_id\":\"nextjs_why_layouts_avoid_redundant_rendering\",\"title\":\"Why layouts avoid redundant rendering\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"nextjs_root_layout_required\",\"title\":\"Root layout (required)\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"nextjs_nested_layouts\",\"title\":\"Nested layouts\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"nextjs_layout_vs_template_difference\",\"title\":\"Layout vs template difference\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"nextjs_metadata_in_layouts\",\"title\":\"Metadata in layouts\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"nextjs_shared_state_across_layouts\",\"title\":\"Shared state across layouts\",\"order\":6,\"has_content\":true},{\"pattern_id\":\"nextjs_layout_navigation_behavior\",\"title\":\"Layout navigation behavior\",\"order\":7,\"has_content\":true},{\"pattern_id\":\"nextjs_multiple_root_layouts_with_route_groups\",\"title\":\"Multiple root layouts with route groups\",\"order\":8,\"has_content\":true}]},{\"topic_id\":\"nextjs_p1_t4\",\"title\":\"Server Components\",\"order\":4,\"pattern_count\":8,\"patterns\":[{\"pattern_id\":\"nextjs_why_server_components_are_the_default\",\"title\":\"Why server components are the default\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"nextjs_server_component_execution_model\",\"title\":\"Server component execution model\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"nextjs_what_can_run_in_server_components\",\"title\":\"What can run in server components\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"nextjs_data_fetching_in_server_components\",\"title\":\"Data fetching in server components\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"nextjs_async_server_components\",\"title\":\"Async server components\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"nextjs_server_component_restrictions\",\"title\":\"Server component restrictions\",\"order\":6,\"has_content\":true},{\"pattern_id\":\"nextjs_zero_bundle_size_for_server_components\",\"title\":\"Zero bundle size for server components\",\"order\":7,\"has_content\":true},{\"pattern_id\":\"nextjs_when_to_keep_components_on_server\",\"title\":\"When to keep components on server\",\"order\":8,\"has_content\":true}]},{\"topic_id\":\"nextjs_p1_t5\",\"title\":\"Client Components\",\"order\":5,\"pattern_count\":8,\"patterns\":[{\"pattern_id\":\"nextjs_why_client_components_handle_interactivity\",\"title\":\"Why client components handle interactivity\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"nextjs_use_client_directive\",\"title\":\"Use client directive\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"nextjs_event_handlers_in_client_components\",\"title\":\"Event handlers in client components\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"nextjs_state_and_hooks_in_client_components\",\"title\":\"State and hooks in client components\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"nextjs_when_to_use_client_components\",\"title\":\"When to use client components\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"nextjs_client_component_boundaries\",\"title\":\"Client component boundaries\",\"order\":6,\"has_content\":true},{\"pattern_id\":\"nextjs_server_and_client_component_composition\",\"title\":\"Server and client component composition\",\"order\":7,\"has_content\":true},{\"pattern_id\":\"nextjs_interleaving_server_and_client\",\"title\":\"Interleaving server and client\",\"order\":8,\"has_content\":true}]},{\"topic_id\":\"nextjs_p1_t6\",\"title\":\"Navigation and Links\",\"order\":6,\"pattern_count\":8,\"patterns\":[{\"pattern_id\":\"nextjs_why_nextjs_navigation_is_optimized\",\"title\":\"Why Next.js navigation is optimized\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"nextjs_link_component_for_client_navigation\",\"title\":\"Link component for client navigation\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"nextjs_active_link_detection\",\"title\":\"Active link detection\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"nextjs_programmatic_navigation_userouter\",\"title\":\"Programmatic navigation (useRouter)\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"nextjs_route_prefetching_behavior\",\"title\":\"Route prefetching behavior\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"nextjs_redirect_function\",\"title\":\"Redirect function\",\"order\":6,\"has_content\":true},{\"pattern_id\":\"nextjs_scroll_behavior_control\",\"title\":\"Scroll behavior control\",\"order\":7,\"has_content\":true},{\"pattern_id\":\"nextjs_parallel_routes_concept\",\"title\":\"Parallel routes concept\",\"order\":8,\"has_content\":true}]},{\"topic_id\":\"nextjs_p1_t7\",\"title\":\"Styling in Next.js\",\"order\":7,\"pattern_count\":8,\"patterns\":[{\"pattern_id\":\"nextjs_why_styling_options_matter\",\"title\":\"Why styling options matter\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"nextjs_css_modules\",\"title\":\"CSS Modules\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"nextjs_global_css\",\"title\":\"Global CSS\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"nextjs_tailwind_css_integration\",\"title\":\"Tailwind CSS integration\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"nextjs_cssinjs_considerations\",\"title\":\"CSS-in-JS considerations\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"nextjs_font_optimization_with_next_font\",\"title\":\"Font optimization with next/font\",\"order\":6,\"has_content\":true},{\"pattern_id\":\"nextjs_image_optimization_with_next_image\",\"title\":\"Image optimization with next/image\",\"order\":7,\"has_content\":true},{\"pattern_id\":\"nextjs_conditional_styling_patterns\",\"title\":\"Conditional styling patterns\",\"order\":8,\"has_content\":true}]},{\"topic_id\":\"nextjs_p1_t8\",\"title\":\"Static Assets and Optimization\",\"order\":8,\"pattern_count\":8,\"patterns\":[{\"pattern_id\":\"nextjs_why_optimization_matters_for_performance\",\"title\":\"Why optimization matters for performance\",\"order\":1,\"has_content\":true},{\"pattern_id\":\"nextjs_public_directory_for_static_files\",\"title\":\"Public directory for static files\",\"order\":2,\"has_content\":true},{\"pattern_id\":\"nextjs_image_component_and_optimization\",\"title\":\"Image component and optimization\",\"order\":3,\"has_content\":true},{\"pattern_id\":\"nextjs_responsive_images\",\"title\":\"Responsive images\",\"order\":4,\"has_content\":true},{\"pattern_id\":\"nextjs_font_optimization_and_selfhosting\",\"title\":\"Font optimization and self-hosting\",\"order\":5,\"has_content\":true},{\"pattern_id\":\"nextjs_script_component_for_thirdparty_scripts\",\"title\":\"Script component for third-party scripts\",\"order\":6,\"has_content\":true},{\"pattern_id\":\"nextjs_metadata_api_for_seo\",\"title\":\"Metadata API for SEO\",\"order\":7,\"has_content\":true},{\"pattern_id\":\"nextjs_open_graph_metadata\",\"title\":\"Open Graph metadata\",\"order\":8,\"has_content\":true}]}]},\"modeCode\":\"DLM\",\"productId\":\"codefly\"}]]\n"])</script><script>self.__next_f.push([1,"13:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"Metadata API for SEO in NextJS - Deep Dive: Internals \u0026 How It Works | Leyaa.ai\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"Go deep on Metadata API for SEO in NextJS. Internals, mental models, under-the-hood mechanics, misconceptions, common pitfalls, and production patterns. For serious learners.\"}],[\"$\",\"meta\",\"4\",{\"name\":\"author\",\"content\":\"Leyaa.ai\"}],[\"$\",\"link\",\"5\",{\"rel\":\"manifest\",\"href\":\"/manifest.json\",\"crossOrigin\":\"use-credentials\"}],[\"$\",\"meta\",\"6\",{\"name\":\"keywords\",\"content\":\"learning intelligence,AI learning,personalized learning,adaptive learning,study guide,exam preparation,learning platform,education technology,edtech,smart learning\"}],[\"$\",\"meta\",\"7\",{\"name\":\"creator\",\"content\":\"Leyaa.ai\"}],[\"$\",\"meta\",\"8\",{\"name\":\"publisher\",\"content\":\"Leyaa.ai\"}],[\"$\",\"meta\",\"9\",{\"name\":\"robots\",\"content\":\"index, follow\"}],[\"$\",\"meta\",\"10\",{\"name\":\"googlebot\",\"content\":\"index, follow, max-image-preview:large, max-snippet:-1\"}],[\"$\",\"meta\",\"11\",{\"name\":\"content-language\",\"content\":\"en\"}],[\"$\",\"link\",\"12\",{\"rel\":\"canonical\",\"href\":\"https://leyaa.ai/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo/deep\"}],[\"$\",\"link\",\"13\",{\"rel\":\"alternate\",\"hrefLang\":\"en\",\"href\":\"https://leyaa.ai/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo/deep\"}],[\"$\",\"link\",\"14\",{\"rel\":\"alternate\",\"hrefLang\":\"x-default\",\"href\":\"https://leyaa.ai/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo/deep\"}],[\"$\",\"meta\",\"15\",{\"property\":\"og:title\",\"content\":\"Metadata API for SEO in NextJS - Deep Dive: Internals \u0026 How It Works | Leyaa.ai\"}],[\"$\",\"meta\",\"16\",{\"property\":\"og:description\",\"content\":\"Go deep on Metadata API for SEO in NextJS. Internals, mental models, under-the-hood mechanics, misconceptions, common pitfalls, and production patterns. For serious learners.\"}],[\"$\",\"meta\",\"17\",{\"property\":\"og:url\",\"content\":\"https://leyaa.ai/codefly/learn/nextjs/part-1/nextjs-metadata-api-for-seo/deep\"}],[\"$\",\"meta\",\"18\",{\"property\":\"og:locale\",\"content\":\"en_US\"}],[\"$\",\"meta\",\"19\",{\"property\":\"og:image\",\"content\":\"https://leyaa.ai/Assets/metaImages/leyaa-preview-image.png\"}],[\"$\",\"meta\",\"20\",{\"property\":\"og:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"21\",{\"property\":\"og:image:height\",\"content\":\"630\"}],[\"$\",\"meta\",\"22\",{\"property\":\"og:image:alt\",\"content\":\"Metadata API for SEO in NextJS - Deep Dive: Internals \u0026 How It Works\"}],[\"$\",\"meta\",\"23\",{\"property\":\"og:type\",\"content\":\"article\"}],[\"$\",\"meta\",\"24\",{\"name\":\"twitter:card\",\"content\":\"summary_large_image\"}],[\"$\",\"meta\",\"25\",{\"name\":\"twitter:site\",\"content\":\"@leyaaai\"}],[\"$\",\"meta\",\"26\",{\"name\":\"twitter:creator\",\"content\":\"@leyaaai\"}],[\"$\",\"meta\",\"27\",{\"name\":\"twitter:title\",\"content\":\"Metadata API for SEO in NextJS - Deep Dive: Internals \u0026 How It Works | Leyaa.ai\"}],[\"$\",\"meta\",\"28\",{\"name\":\"twitter:description\",\"content\":\"Go deep on Metadata API for SEO in NextJS. Internals, mental models, under-the-hood mechanics, misconceptions, common pitfalls, and production patterns. For serious learners.\"}],[\"$\",\"meta\",\"29\",{\"name\":\"twitter:image\",\"content\":\"https://leyaa.ai/Assets/metaImages/leyaa-preview-image.png\"}],[\"$\",\"link\",\"30\",{\"rel\":\"icon\",\"href\":\"/leyaa-logo.png\"}],[\"$\",\"link\",\"31\",{\"rel\":\"apple-touch-icon\",\"href\":\"/leyaa-logo.png\"}],[\"$\",\"meta\",\"32\",{\"name\":\"next-size-adjust\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\n"])</script></body></html>