{
    "componentChunkName": "component---src-pages-blog-markdown-remark-fields-slug-js",
    "path": "/blog/nextjs-metadata",
    "result": {"data":{"markdownRemark":{"html":"<p>Imagine walking through the Van Gogh Museum, exploring different rooms that correspond to significant life moments of the illustrious and fascinating Dutch painter. 🎨</p>\n<p>Each painting is accompanied by a placard that provides crucial details about each of his works (its title, the year it was painted, and a short description). Without these, you will find yourself struggling to understand the artwork’s meaning, historical context, or significance.</p>\n<p>On the web, <strong>metadata</strong> serves a similar purpose. It provides essential information about a webpage (like its title, description, and keywords). <strong>Metadata helps search engines and social media platforms “understand” your content and present it to the right audience.</strong></p>\n<p>Just as well-written placards enhance a museum experience, well-structured metadata improves your website’s SEO, shareability, and visibility.</p>\n<p>In <strong>Next.js</strong>, managing metadata effectively can make your site more discoverable and engaging. If you’ve ever seen <meta name=\"description\" content=\"...\"> or <title>Page Title</title> in an HTML file, you’ve encountered metadata. And just like Van Gogh’s The Starry Night, it might not change how a page <strong>looks</strong>, but it plays a <strong>crucial role behind the scenes</strong>.</p>\n<p>In this article, we’ll explore how to craft effective metadata in Next.js and ensure your site’s “placards” are as informative and compelling as possible. 🖼️🚀</p>\n<p>The <strong>first section</strong> provides a brief introduction to metadata and what it can do for you. <br>\nThe <strong>second section</strong> dives into how you can use Next.js for your metadata management.</p>\n<p><img src=\"https://media4.giphy.com/media/v1.Y2lkPTc5MGI3NjExdWdjanBrZTFlNnlkZXRvOXZ0dWxwbmczemg5cWI5dzVpb3IwcDZleCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/g9wbFB61YEh1u/giphy.gif\" alt=\"Van Gogh&#x27;s The Starry Night GIF\"></p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"90243860951954600000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`tight: true\ntoHeading: 3`, `90243860951954600000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"table-of-contents\">\n<ul>\n<li><a href=\"#-metadata-explained-how-it-boosts-seo-and-website-visibility\">👉 Metadata Explained: How It Boosts SEO and Website Visibility</a>\n<ul>\n<li><a href=\"#why-metadata-is-important\">Why Metadata is Important</a></li>\n<li><a href=\"#types-of-metadata\">Types of Metadata</a></li>\n</ul>\n</li>\n<li><a href=\"#-nextjs-metadata-for-seo-best-practices-and-implementation\">🌟 Next.js Metadata for SEO: Best Practices and Implementation</a>\n<ul>\n<li><a href=\"#%EF%B8%8F-metadata-inheritance-and-overriding\">🏗️ Metadata Inheritance and Overriding</a></li>\n<li><a href=\"#adding-metadata-in-your-nextjs-app\">Adding Metadata In Your Next.js App</a></li>\n<li><a href=\"#best-practices-for-metadata-management-\">Best Practices for Metadata Management 📌</a></li>\n</ul>\n</li>\n<li><a href=\"#conclusion-\">Conclusion 🎯</a></li>\n</ul>\n</div>\n<h2 id=\"-metadata-explained-how-it-boosts-seo-and-website-visibility\" style=\"position:relative;\"><a href=\"#-metadata-explained-how-it-boosts-seo-and-website-visibility\" aria-label=\" metadata explained how it boosts seo and website visibility permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>👉 Metadata Explained: How It Boosts SEO and Website Visibility</h2>\n<p>Metadata is <strong>extra information</strong> that gives valuable insights into your app’s data. It summarizes basic information about your data. You can think of it as <strong>“data about your data”</strong>! 📊🔍</p>\n<p>It includes page <strong>titles</strong>, <strong>descriptions</strong>, <strong>keywords</strong>, and <strong>social media previews</strong> 📌✨ — all of which help make your web app easier to find, understand, and use.</p>\n<p>Here is an example of metadata you may have seen in the <code class=\"language-text\">&lt;head></code> tag of any HTML file:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"71498705755311160000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`<head>\n    <!-- Basic Metadata -->\n    <title>The Starry Night by Vincent van Gogh</title> <!-- Sets the page title (shown in browser tab) -->\n    <meta charset=&quot;UTF-8&quot;> <!-- Defines character encoding -->\n    <meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;> <!-- Ensures responsive design -->\n    \n    <!-- SEO Metadata -->\n    <meta name=&quot;description&quot; content=&quot;Explore 'The Starry Night,' Vincent van Gogh's iconic masterpiece. Learn about its history, meaning, and artistic techniques.&quot;>\n    <meta name=&quot;keywords&quot; content=&quot;The Starry Night, Vincent van Gogh, Impressionism, famous paintings, art history&quot;>\n    <meta name=&quot;author&quot; content=&quot;Vincent van Gogh&quot;>\n    <meta name=&quot;robots&quot; content=&quot;index, follow&quot;> <!-- Allows search engines to index the page -->\n\n    <!-- Open Graph (OG) Metadata for Social Media -->\n    <meta property=&quot;og:title&quot; content=&quot;The Starry Night - Vincent van Gogh&quot;>\n    <meta property=&quot;og:description&quot; content=&quot;Discover the story behind 'The Starry Night,' one of Vincent van Gogh's most famous paintings.&quot;>\n    <meta property=&quot;og:image&quot; content=&quot;https://example.com/starry-night.jpg&quot;>\n    <meta property=&quot;og:url&quot; content=&quot;https://example.com/starry-night&quot;>\n    <meta property=&quot;og:type&quot; content=&quot;article&quot;>\n\n    <!-- Favicon -->\n    <link rel=&quot;icon&quot; type=&quot;image/png&quot; href=&quot;starry-night-favicon.png&quot;>\n</head>`, `71498705755311160000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"html\"><pre class=\"language-html\"><code class=\"language-html\"><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>head</span><span class=\"token punctuation\">></span></span>\n    <span class=\"token comment\">&lt;!-- Basic Metadata --></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>title</span><span class=\"token punctuation\">></span></span>The Starry Night by Vincent van Gogh<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>title</span><span class=\"token punctuation\">></span></span> <span class=\"token comment\">&lt;!-- Sets the page title (shown in browser tab) --></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">charset</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>UTF-8<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span> <span class=\"token comment\">&lt;!-- Defines character encoding --></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">name</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>viewport<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>width=device-width, initial-scale=1.0<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span> <span class=\"token comment\">&lt;!-- Ensures responsive design --></span>\n    \n    <span class=\"token comment\">&lt;!-- SEO Metadata --></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">name</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>description<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>Explore <span class=\"token punctuation\">'</span>The Starry Night,<span class=\"token punctuation\">'</span> Vincent van Gogh<span class=\"token punctuation\">'</span>s iconic masterpiece. Learn about its history, meaning, and artistic techniques.<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">name</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>keywords<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>The Starry Night, Vincent van Gogh, Impressionism, famous paintings, art history<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">name</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>author<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>Vincent van Gogh<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">name</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>robots<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>index, follow<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span> <span class=\"token comment\">&lt;!-- Allows search engines to index the page --></span>\n\n    <span class=\"token comment\">&lt;!-- Open Graph (OG) Metadata for Social Media --></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">property</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>og:title<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>The Starry Night - Vincent van Gogh<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">property</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>og:description<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>Discover the story behind <span class=\"token punctuation\">'</span>The Starry Night,<span class=\"token punctuation\">'</span> one of Vincent van Gogh<span class=\"token punctuation\">'</span>s most famous paintings.<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">property</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>og:image<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>https://example.com/starry-night.jpg<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">property</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>og:url<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>https://example.com/starry-night<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">property</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>og:type<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>article<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n\n    <span class=\"token comment\">&lt;!-- Favicon --></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>link</span> <span class=\"token attr-name\">rel</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>icon<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">type</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>image/png<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">href</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>starry-night-favicon.png<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>head</span><span class=\"token punctuation\">></span></span></code></pre></div>\n<h3 id=\"why-metadata-is-important\" style=\"position:relative;\"><a href=\"#why-metadata-is-important\" aria-label=\"why metadata is important permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why Metadata is Important</h3>\n<p>Metadata is vital for search engines to rank your content and enhance SEO.</p>\n<p>Proper metadata configuration enhances SEO by:</p>\n<ul>\n<li><strong>Improving Search Engine Rankings</strong>: Accurate titles and descriptions help search engines understand page content.</li>\n<li><strong>Optimizing Social Media Sharing</strong>: Open Graph metadata ensures rich previews when links are shared.</li>\n<li><strong>Increasing Click-Through Rates</strong>: Compelling metadata can attract users to click on your links in search results.</li>\n</ul>\n<h3 id=\"types-of-metadata\" style=\"position:relative;\"><a href=\"#types-of-metadata\" aria-label=\"types of metadata permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Types of Metadata</h3>\n<p>There are various types of metadata. Some common ones, that you will encounter often, are <strong>title</strong>, <strong>description</strong>, <strong>keywords</strong>, <strong>open graph</strong>, and <strong>favicon</strong>.</p>\n<h4 id=\"title-metadata\" style=\"position:relative;\"><a href=\"#title-metadata\" aria-label=\"title metadata permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Title Metadata</h4>\n<p>The <strong>title metadata</strong> defines the title of a webpage shown on the browser tab and in search engine results.</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"28243161377403080000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`<title>Page Title</title>`, `28243161377403080000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"html\"><pre class=\"language-html\"><code class=\"language-html\"><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>title</span><span class=\"token punctuation\">></span></span>Page Title<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>title</span><span class=\"token punctuation\">></span></span></code></pre></div>\n<h4 id=\"description-metadata\" style=\"position:relative;\"><a href=\"#description-metadata\" aria-label=\"description metadata permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Description Metadata</h4>\n<p>The <strong>description metadata</strong> provides a summary of the webpage content, which is crucial for SEO. The description property corresponds to the meta tag in the head section of the document.</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"59258287072572880000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`<meta name=&quot;description&quot; content=&quot;A brief description of the page content.&quot; />`, `59258287072572880000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"html\"><pre class=\"language-html\"><code class=\"language-html\"><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">name</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>description<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>A brief description of the page content.<span class=\"token punctuation\">\"</span></span> <span class=\"token punctuation\">/></span></span></code></pre></div>\n<h4 id=\"keyword-metadata\" style=\"position:relative;\"><a href=\"#keyword-metadata\" aria-label=\"keyword metadata permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Keyword Metadata</h4>\n<p>The <strong>keyword metadata</strong> includes keywords related to the webpage content, aiding in search engine indexing.</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"5731973858585060000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`<meta name=&quot;keywords&quot; content=&quot;keyword1, keyword2, keyword3&quot; />`, `5731973858585060000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"html\"><pre class=\"language-html\"><code class=\"language-html\"><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">name</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>keywords<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>keyword1, keyword2, keyword3<span class=\"token punctuation\">\"</span></span> <span class=\"token punctuation\">/></span></span></code></pre></div>\n<h4 id=\"open-graph-metadata\" style=\"position:relative;\"><a href=\"#open-graph-metadata\" aria-label=\"open graph metadata permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open Graph Metadata</h4>\n<p>The <strong>Open Graph metadata</strong> (part of the <a href=\"https://ogp.me/\" target=\"_blank\" rel=\"nofollow\">Open Graph protocol</a>) enhances the presentation of web pages on social media platforms by specifying details like title, description, and preview images. They are used by Facebook, X (formerly Twitter), LinkedIn, Discord, Slack, and others.</p>\n<p>The <strong>Open Graph protocol</strong> specifies the different types of meta tags that you can use to describe your data.</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"33886847639105876000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`<meta property=&quot;og:title&quot; content=&quot;Title Here&quot; />\n<meta property=&quot;og:description&quot; content=&quot;Description Here&quot; />\n<meta property=&quot;og:image&quot; content=&quot;image_url_here&quot; />\n<meta property=&quot;og:url&quot; content=&quot;https://imgsrc.io/guides/open-graph-meta-tags&quot; />`, `33886847639105876000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"html\"><pre class=\"language-html\"><code class=\"language-html\"><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">property</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>og:title<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>Title Here<span class=\"token punctuation\">\"</span></span> <span class=\"token punctuation\">/></span></span>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">property</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>og:description<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>Description Here<span class=\"token punctuation\">\"</span></span> <span class=\"token punctuation\">/></span></span>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">property</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>og:image<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>image_url_here<span class=\"token punctuation\">\"</span></span> <span class=\"token punctuation\">/></span></span>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">property</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>og:url<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>https://imgsrc.io/guides/open-graph-meta-tags<span class=\"token punctuation\">\"</span></span> <span class=\"token punctuation\">/></span></span></code></pre></div>\n<h4 id=\"favicon-metadata\" style=\"position:relative;\"><a href=\"#favicon-metadata\" aria-label=\"favicon metadata permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Favicon Metadata</h4>\n<p>The <strong>favicon metadata</strong> links the favicon to the webpage, displayed in the browser’s address bar or tab.</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"67564367717253005000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`<link rel=&quot;icon&quot; href=&quot;path/to/favicon.ico&quot; />`, `67564367717253005000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"html\"><pre class=\"language-html\"><code class=\"language-html\"><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>link</span> <span class=\"token attr-name\">rel</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>icon<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">href</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>path/to/favicon.ico<span class=\"token punctuation\">\"</span></span> <span class=\"token punctuation\">/></span></span></code></pre></div>\n<h2 id=\"-nextjs-metadata-for-seo-best-practices-and-implementation\" style=\"position:relative;\"><a href=\"#-nextjs-metadata-for-seo-best-practices-and-implementation\" aria-label=\" nextjs metadata for seo best practices and implementation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>🌟 Next.js Metadata for SEO: Best Practices and Implementation</h2>\n<p>Next.js has a <strong>Metadata API</strong> that is used to define and manage your app’s metadata. <br> It allows you to modify the <code class=\"language-text\">&lt;head></code> element of a page.</p>\n<blockquote>\n<p>🗂️ <strong>Metadata management</strong> helps users easily access and understand data (what it means, where it comes from, how it’s structured, how it connects to other data, and any usage rules).</p>\n</blockquote>\n<h3 id=\"️-metadata-inheritance-and-overriding\" style=\"position:relative;\"><a href=\"#%EF%B8%8F-metadata-inheritance-and-overriding\" aria-label=\"️ metadata inheritance and overriding permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>🏗️ Metadata Inheritance and Overriding</h3>\n<p><strong>Next.js</strong> organizes metadata in a hierarchy, ensuring consistency while allowing pages to set their own unique details.</p>\n<h4 id=\"-how-metadata-inheritance-works\" style=\"position:relative;\"><a href=\"#-how-metadata-inheritance-works\" aria-label=\" how metadata inheritance works permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>🔗 How Metadata Inheritance Works</h4>\n<p>To keep things organized, Next.js allows you to set global metadata for your entire site while letting individual pages override or extend it when needed. This ensures consistency, giving each page the flexibility to have its own unique details. 🚀</p>\n<h5 id=\"global-metadata-applied-to-all-pages\" style=\"position:relative;\"><a href=\"#global-metadata-applied-to-all-pages\" aria-label=\"global metadata applied to all pages permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Global Metadata (Applied to All Pages)</h5>\n<p>Set in <code class=\"language-text\">layout.js</code>:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"95121407960749100000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`export const metadata = {\n  title: &quot;My Website&quot;,\n  description: &quot;A great website built with Next.js&quot;,\n};`, `95121407960749100000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">export</span> <span class=\"token keyword\">const</span> metadata <span class=\"token operator\">=</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token string\">\"My Website\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token literal-property property\">description</span><span class=\"token operator\">:</span> <span class=\"token string\">\"A great website built with Next.js\"</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span></code></pre></div>\n<h5 id=\"page-specific-metadata-overrides-global-values\" style=\"position:relative;\"><a href=\"#page-specific-metadata-overrides-global-values\" aria-label=\"page specific metadata overrides global values permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Page-Specific Metadata (Overrides Global Values)</h5>\n<p>Set in <code class=\"language-text\">page.js</code>:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"90488072895518470000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`export const metadata = {\n  title: &quot;About Us - My Website&quot;, // Overrides global title\n  description: &quot;Learn more about our team and mission.&quot;, // Overrides global description\n};`, `90488072895518470000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">export</span> <span class=\"token keyword\">const</span> metadata <span class=\"token operator\">=</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token string\">\"About Us - My Website\"</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">// Overrides global title</span>\n  <span class=\"token literal-property property\">description</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Learn more about our team and mission.\"</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">// Overrides global description</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>The output in the <code class=\"language-text\">&lt;head></code> section for the About page will be:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"52996177392036545000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`<title>About Us - My Website</title>\n<meta name=&quot;description&quot; content=&quot;Learn more about our team and mission.&quot;>`, `52996177392036545000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"html\"><pre class=\"language-html\"><code class=\"language-html\"><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>title</span><span class=\"token punctuation\">></span></span>About Us - My Website<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>title</span><span class=\"token punctuation\">></span></span>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">name</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>description<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>Learn more about our team and mission.<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span></code></pre></div>\n<p>Summary:</p>\n<ul>\n<li><strong>Root Layout Metadata:</strong> Define a default structure in the main layout (<code class=\"language-text\">layout.js</code>).</li>\n<li><strong>Nested Layouts:</strong> Override or extend metadata for specific sections of the site.</li>\n<li><strong>Page Metadata:</strong> Each page can refine or replace metadata as needed.</li>\n</ul>\n<hr>\n<h3 id=\"adding-metadata-in-your-nextjs-app\" style=\"position:relative;\"><a href=\"#adding-metadata-in-your-nextjs-app\" aria-label=\"adding metadata in your nextjs app permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Adding Metadata In Your Next.js App</h3>\n<p>There are two ways to add metadata to your app, <strong>config-based</strong> and <strong>file-based metadata</strong>. <br> Both methods help manage SEO-related information like page titles, descriptions, and Open Graph tags.</p>\n<p>Below is a detailed guide on how to utilize both options effectively.</p>\n<h4 id=\"config-based-metadata\" style=\"position:relative;\"><a href=\"#config-based-metadata\" aria-label=\"config based metadata permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Config-Based Metadata</h4>\n<p>Config-based metadata is added in <strong>layout.js</strong> or <strong>page.js</strong> by using a static <code class=\"language-text\">metadata</code> object or a dynamic <code class=\"language-text\">generateMetadata()</code> function.</p>\n<h5 id=\"configuring-static-metadata\" style=\"position:relative;\"><a href=\"#configuring-static-metadata\" aria-label=\"configuring static metadata permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Configuring Static Metadata</h5>\n<p>Static Metadata is predefined and remains constant across sessions. To implement static metadata in Next.js:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"93387240875679400000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`export const metadata = {\n    title: ' ... ', \n    description: ' ... ',\n}\n\nexport default function Page() {}`, `93387240875679400000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">export</span> <span class=\"token keyword\">const</span> metadata <span class=\"token operator\">=</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token string\">' ... '</span><span class=\"token punctuation\">,</span> \n    <span class=\"token literal-property property\">description</span><span class=\"token operator\">:</span> <span class=\"token string\">' ... '</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">export</span> <span class=\"token keyword\">default</span> <span class=\"token keyword\">function</span> <span class=\"token function\">Page</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span></code></pre></div>\n<p>This setup ensures that all pages inheriting from this layout share the same metadata.</p>\n<h5 id=\"configuring-dynamic-metadata\" style=\"position:relative;\"><a href=\"#configuring-dynamic-metadata\" aria-label=\"configuring dynamic metadata permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Configuring Dynamic Metadata</h5>\n<p>Dynamic metadata adapts based on content or user interaction.\nYou can use the <code class=\"language-text\">generateMetadata</code> function to <code class=\"language-text\">fetch</code> metadata that requires dynamic values.</p>\n<p>To configure dynamic metadata:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"20447198901390262000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`export async function generateMetadata({ params, searchParams }, parent) {\n    // read route params\n    const id = (await params).id\n\n    // fetch data\n    const product = await fetch(\\`https://.../\\${id}\\`).then((res) => res.json())\n\n    // optionally access and extend (rather than replace) parent metadata\n    const previousImage = (await parent).openGraph?.images || []\n\n    return {\n        title: product.title,\n        openGraph: {\n            images: ['/some-specific-page-image.jpg', ...previousImages],\n        },\n    }\n}\n\nexport default function Page({ params, searchParams }) {}`, `20447198901390262000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">export</span> <span class=\"token keyword\">async</span> <span class=\"token keyword\">function</span> <span class=\"token function\">generateMetadata</span><span class=\"token punctuation\">(</span><span class=\"token parameter\"><span class=\"token punctuation\">{</span> params<span class=\"token punctuation\">,</span> searchParams <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span> parent</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token comment\">// read route params</span>\n    <span class=\"token keyword\">const</span> id <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span><span class=\"token keyword\">await</span> params<span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span>id\n\n    <span class=\"token comment\">// fetch data</span>\n    <span class=\"token keyword\">const</span> product <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> <span class=\"token function\">fetch</span><span class=\"token punctuation\">(</span><span class=\"token template-string\"><span class=\"token template-punctuation string\">`</span><span class=\"token string\">https://.../</span><span class=\"token interpolation\"><span class=\"token interpolation-punctuation punctuation\">${</span>id<span class=\"token interpolation-punctuation punctuation\">}</span></span><span class=\"token template-punctuation string\">`</span></span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">then</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">res</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> res<span class=\"token punctuation\">.</span><span class=\"token function\">json</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span>\n\n    <span class=\"token comment\">// optionally access and extend (rather than replace) parent metadata</span>\n    <span class=\"token keyword\">const</span> previousImage <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span><span class=\"token keyword\">await</span> parent<span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span>openGraph<span class=\"token operator\">?.</span>images <span class=\"token operator\">||</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span>\n\n    <span class=\"token keyword\">return</span> <span class=\"token punctuation\">{</span>\n        <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> product<span class=\"token punctuation\">.</span>title<span class=\"token punctuation\">,</span>\n        <span class=\"token literal-property property\">openGraph</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n            <span class=\"token literal-property property\">images</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token string\">'/some-specific-page-image.jpg'</span><span class=\"token punctuation\">,</span> <span class=\"token operator\">...</span>previousImages<span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span>\n        <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">export</span> <span class=\"token keyword\">default</span> <span class=\"token keyword\">function</span> <span class=\"token function\">Page</span><span class=\"token punctuation\">(</span><span class=\"token parameter\"><span class=\"token punctuation\">{</span> params<span class=\"token punctuation\">,</span> searchParams <span class=\"token punctuation\">}</span></span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span></code></pre></div>\n<p>This approach is beneficial for pages where metadata depends on dynamic data, such as product details or user-generated content.</p>\n<h4 id=\"file-based-metadata\" style=\"position:relative;\"><a href=\"#file-based-metadata\" aria-label=\"file based metadata permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>File-Based Metadata</h4>\n<p>File-based metadata is added in <strong>special metadata files</strong> in your project’s folders, either statically or dynamically:</p>\n<ul>\n<li>favicon.ico, apple-icon.jpg, and icon.jpg</li>\n<li>opengraph-image.jpg and twitter-image.jpg</li>\n<li>robots.txt</li>\n<li>sitemap.xml</li>\n</ul>\n<h5 id=\"️-faviconico-apple-iconjpg-and-iconjpg\" style=\"position:relative;\"><a href=\"#%EF%B8%8F-faviconico-apple-iconjpg-and-iconjpg\" aria-label=\"️ faviconico apple iconjpg and iconjpg permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>🖼️ favicon.ico, apple-icon.jpg, and icon.jpg</h5>\n<p>The favicon.ico, apple-icon.jpg, and icon.jpg files are used to provide your website with consistent branding across different platforms and devices.</p>\n<ul>\n<li><strong>favicon.ico</strong> is the small icon that appears in the browser tab.</li>\n<li><strong>apple-icon.jpg</strong> is used for the home screen icon on iOS devices.</li>\n<li><strong>icon.jpg</strong> is used for a more general icon that can appear across other platforms, like Android or web apps.</li>\n</ul>\n<p>Here’s how to include them in your Next.js project:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"53463951664942514000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`<!-- Favicon for browsers -->\n<link rel=&quot;icon&quot; href=&quot;https://example.com/favicon.ico&quot; type=&quot;image/x-icon&quot;>\n\n<!-- Apple icon for iOS devices -->\n<link rel=&quot;apple-touch-icon&quot; href=&quot;https://example.com/apple-icon.jpg&quot;>\n\n<!-- General icon for web apps -->\n<link rel=&quot;icon&quot; href=&quot;https://example.com/icon.jpg&quot; type=&quot;image/jpg&quot;>`, `53463951664942514000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"html\"><pre class=\"language-html\"><code class=\"language-html\"><span class=\"token comment\">&lt;!-- Favicon for browsers --></span>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>link</span> <span class=\"token attr-name\">rel</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>icon<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">href</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>https://example.com/favicon.ico<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">type</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>image/x-icon<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n\n<span class=\"token comment\">&lt;!-- Apple icon for iOS devices --></span>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>link</span> <span class=\"token attr-name\">rel</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>apple-touch-icon<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">href</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>https://example.com/apple-icon.jpg<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n\n<span class=\"token comment\">&lt;!-- General icon for web apps --></span>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>link</span> <span class=\"token attr-name\">rel</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>icon<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">href</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>https://example.com/icon.jpg<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">type</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>image/jpg<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span></code></pre></div>\n<p>In Next.js, you can define these dynamically in the <code class=\"language-text\">_document.js</code> file:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"46352825043132320000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`import Document, { Html, Head, Main, NextScript } from 'next/document';\n\nclass MyDocument extends Document {\n  render() {\n    return (\n      <Html>\n        <Head>\n          <link rel=&quot;icon&quot; href=&quot;https://example.com/favicon.ico&quot; type=&quot;image/x-icon&quot; />\n          <link rel=&quot;apple-touch-icon&quot; href=&quot;https://example.com/apple-icon.jpg&quot; />\n          <link rel=&quot;icon&quot; href=&quot;https://example.com/icon.jpg&quot; type=&quot;image/jpg&quot; />\n        </Head>\n        <body>\n          <Main />\n          <NextScript />\n        </body>\n      </Html>\n    );\n  }\n}\n\nexport default MyDocument;`, `46352825043132320000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">import</span> Document<span class=\"token punctuation\">,</span> <span class=\"token punctuation\">{</span> Html<span class=\"token punctuation\">,</span> Head<span class=\"token punctuation\">,</span> Main<span class=\"token punctuation\">,</span> NextScript <span class=\"token punctuation\">}</span> <span class=\"token keyword\">from</span> <span class=\"token string\">'next/document'</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">class</span> <span class=\"token class-name\">MyDocument</span> <span class=\"token keyword\">extends</span> <span class=\"token class-name\">Document</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">render</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">return</span> <span class=\"token punctuation\">(</span>\n      <span class=\"token operator\">&lt;</span>Html<span class=\"token operator\">></span>\n        <span class=\"token operator\">&lt;</span>Head<span class=\"token operator\">></span>\n          <span class=\"token operator\">&lt;</span>link rel<span class=\"token operator\">=</span><span class=\"token string\">\"icon\"</span> href<span class=\"token operator\">=</span><span class=\"token string\">\"https://example.com/favicon.ico\"</span> type<span class=\"token operator\">=</span><span class=\"token string\">\"image/x-icon\"</span> <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n          <span class=\"token operator\">&lt;</span>link rel<span class=\"token operator\">=</span><span class=\"token string\">\"apple-touch-icon\"</span> href<span class=\"token operator\">=</span><span class=\"token string\">\"https://example.com/apple-icon.jpg\"</span> <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n          <span class=\"token operator\">&lt;</span>link rel<span class=\"token operator\">=</span><span class=\"token string\">\"icon\"</span> href<span class=\"token operator\">=</span><span class=\"token string\">\"https://example.com/icon.jpg\"</span> type<span class=\"token operator\">=</span><span class=\"token string\">\"image/jpg\"</span> <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n        <span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>Head<span class=\"token operator\">></span>\n        <span class=\"token operator\">&lt;</span>body<span class=\"token operator\">></span>\n          <span class=\"token operator\">&lt;</span>Main <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n          <span class=\"token operator\">&lt;</span>NextScript <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n        <span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>body<span class=\"token operator\">></span>\n      <span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>Html<span class=\"token operator\">></span>\n    <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">export</span> <span class=\"token keyword\">default</span> MyDocument<span class=\"token punctuation\">;</span></code></pre></div>\n<p>These icons help brand your website and ensure that it looks great on all devices and in every browser tab.</p>\n<h5 id=\"-opengraph-imagejpg-and-twitter-imagejpg\" style=\"position:relative;\"><a href=\"#-opengraph-imagejpg-and-twitter-imagejpg\" aria-label=\" opengraph imagejpg and twitter imagejpg permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>📷 opengraph-image.jpg and twitter-image.jpg</h5>\n<p>The opengraph-image.jpg and twitter-image.jpg files are used to set the preview image when your content is shared on social media platforms like <strong>Facebook</strong> and <strong>X</strong> <em>(previously Twitter)</em>. These images provide a visual representation of your page, making it more engaging and clickable.</p>\n<p>For Open Graph (OG) and X/Twitter Cards, you would typically add the following metadata:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"43329722462480330000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`<!-- Open Graph Metadata -->\n<meta property=&quot;og:image&quot; content=&quot;https://example.com/opengraph-image.jpg&quot;>\n\n<!-- Twitter Card Metadata -->\n<meta name=&quot;twitter:image&quot; content=&quot;https://example.com/twitter-image.jpg&quot;>`, `43329722462480330000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"html\"><pre class=\"language-html\"><code class=\"language-html\"><span class=\"token comment\">&lt;!-- Open Graph Metadata --></span>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">property</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>og:image<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>https://example.com/opengraph-image.jpg<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n\n<span class=\"token comment\">&lt;!-- Twitter Card Metadata --></span>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>meta</span> <span class=\"token attr-name\">name</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>twitter:image<span class=\"token punctuation\">\"</span></span> <span class=\"token attr-name\">content</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>https://example.com/twitter-image.jpg<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span></code></pre></div>\n<p>In Next.js, you can define these dynamically using a function:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"67438241321548186000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`export default function Page() {\n  const ogImage = 'https://example.com/opengraph-image.jpg';\n  const twitterImage = 'https://example.com/twitter-image.jpg';\n\n  return (\n    <>\n      <Head>\n        <meta property=&quot;og:image&quot; content={ogImage} />\n        <meta name=&quot;twitter:image&quot; content={twitterImage} />\n      </Head>\n    </>\n  );\n}\n\n// Output:\n\n// <meta property=&quot;og:image&quot; content=&quot;https://example.com/opengraph-image.jpg&quot;>\n// <meta name=&quot;twitter:image&quot; content=&quot;https://example.com/twitter-image.jpg&quot;>`, `67438241321548186000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">export</span> <span class=\"token keyword\">default</span> <span class=\"token keyword\">function</span> <span class=\"token function\">Page</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">const</span> ogImage <span class=\"token operator\">=</span> <span class=\"token string\">'https://example.com/opengraph-image.jpg'</span><span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">const</span> twitterImage <span class=\"token operator\">=</span> <span class=\"token string\">'https://example.com/twitter-image.jpg'</span><span class=\"token punctuation\">;</span>\n\n  <span class=\"token keyword\">return</span> <span class=\"token punctuation\">(</span>\n    <span class=\"token operator\">&lt;</span><span class=\"token operator\">></span>\n      <span class=\"token operator\">&lt;</span>Head<span class=\"token operator\">></span>\n        <span class=\"token operator\">&lt;</span>meta property<span class=\"token operator\">=</span><span class=\"token string\">\"og:image\"</span> content<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>ogImage<span class=\"token punctuation\">}</span> <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n        <span class=\"token operator\">&lt;</span>meta name<span class=\"token operator\">=</span><span class=\"token string\">\"twitter:image\"</span> content<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>twitterImage<span class=\"token punctuation\">}</span> <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n      <span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>Head<span class=\"token operator\">></span>\n    <span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span><span class=\"token operator\">></span>\n  <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Output:</span>\n\n<span class=\"token comment\">// &lt;meta property=\"og:image\" content=\"https://example.com/opengraph-image.jpg\"></span>\n<span class=\"token comment\">// &lt;meta name=\"twitter:image\" content=\"https://example.com/twitter-image.jpg\"></span></code></pre></div>\n<p>These images help ensure that when your page is shared on social media, it has a beautiful, relevant preview that attracts attention!</p>\n<h5 id=\"-robotstxt\" style=\"position:relative;\"><a href=\"#-robotstxt\" aria-label=\" robotstxt permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>🤖 robots.txt</h5>\n<p>The robots.txt file tells search engine crawlers which URLs they can access on your site and looks something like this:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"80580866895952380000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`User-Agent: *\nAllow: /\nDisallow: /private/\nSitemap: https://example.com/sitemap.xml`, `80580866895952380000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">User-Agent: *\nAllow: /\nDisallow: /private/\nSitemap: https://example.com/sitemap.xml</code></pre></div>\n<p>In Next.js, you can either write your file like the above example (static) or generate it (dynamic) in a robots.js/.ts file.</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"12462073426693210000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`export default function robots() {\n  return {\n    rules: {\n      userAgent: '*',\n      allow: '/',\n      disallow: '/private/',\n    },\n    sitemap: 'https://example.com/sitemap.xml',\n  }\n}\n\n// Output:\n\n// User-Agent: *\n// Allow: /\n// Disallow: /private/\n// Sitemap: https://example.com/sitemap.xml`, `12462073426693210000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">export</span> <span class=\"token keyword\">default</span> <span class=\"token keyword\">function</span> <span class=\"token function\">robots</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">return</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token literal-property property\">rules</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token literal-property property\">userAgent</span><span class=\"token operator\">:</span> <span class=\"token string\">'*'</span><span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">allow</span><span class=\"token operator\">:</span> <span class=\"token string\">'/'</span><span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">disallow</span><span class=\"token operator\">:</span> <span class=\"token string\">'/private/'</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">sitemap</span><span class=\"token operator\">:</span> <span class=\"token string\">'https://example.com/sitemap.xml'</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Output:</span>\n\n<span class=\"token comment\">// User-Agent: *</span>\n<span class=\"token comment\">// Allow: /</span>\n<span class=\"token comment\">// Disallow: /private/</span>\n<span class=\"token comment\">// Sitemap: https://example.com/sitemap.xml</span></code></pre></div>\n<h5 id=\"️-sitemapxml\" style=\"position:relative;\"><a href=\"#%EF%B8%8F-sitemapxml\" aria-label=\"️ sitemapxml permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>🗺️ sitemap.xml</h5>\n<p>The sitemap.xml file provides search engines with a structured map of all the important pages on your site, helping them crawl and index your content more efficiently. It looks something like this:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"6819126049741220000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>\n<urlset xmlns=&quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;>\n  <url>\n    <loc>https://example.com/</loc>\n    <lastmod>2025-03-01</lastmod>\n    <priority>1.0</priority>\n  </url>\n  <url>\n    <loc>https://example.com/about</loc>\n    <lastmod>2025-02-15</lastmod>\n    <priority>0.8</priority>\n  </url>\n</urlset>`, `6819126049741220000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"xml\"><pre class=\"language-xml\"><code class=\"language-xml\"><span class=\"token prolog\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>urlset</span> <span class=\"token attr-name\">xmlns</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>http://www.sitemaps.org/schemas/sitemap/0.9<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n  <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>url</span><span class=\"token punctuation\">></span></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>loc</span><span class=\"token punctuation\">></span></span>https://example.com/<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>loc</span><span class=\"token punctuation\">></span></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>lastmod</span><span class=\"token punctuation\">></span></span>2025-03-01<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>lastmod</span><span class=\"token punctuation\">></span></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>priority</span><span class=\"token punctuation\">></span></span>1.0<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>priority</span><span class=\"token punctuation\">></span></span>\n  <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>url</span><span class=\"token punctuation\">></span></span>\n  <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>url</span><span class=\"token punctuation\">></span></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>loc</span><span class=\"token punctuation\">></span></span>https://example.com/about<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>loc</span><span class=\"token punctuation\">></span></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>lastmod</span><span class=\"token punctuation\">></span></span>2025-02-15<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>lastmod</span><span class=\"token punctuation\">></span></span>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>priority</span><span class=\"token punctuation\">></span></span>0.8<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>priority</span><span class=\"token punctuation\">></span></span>\n  <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>url</span><span class=\"token punctuation\">></span></span>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>urlset</span><span class=\"token punctuation\">></span></span></code></pre></div>\n<p>In Next.js, you can create a static sitemap.xml file or generate it dynamically. Here’s how to generate it dynamically:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"81783650806462680000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`export default function sitemap() {\n  return [\n    {\n      url: 'https://example.com/',\n      lastModified: '2025-03-01',\n      priority: 1.0,\n    },\n    {\n      url: 'https://example.com/about',\n      lastModified: '2025-02-15',\n      priority: 0.8,\n    },\n  ]\n}\n\n// Output:\n\n// <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>\n// <urlset xmlns=&quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;>\n//   <url>\n//     <loc>https://example.com/</loc>\n//     <lastmod>2025-03-01</lastmod>\n//     <priority>1.0</priority>\n//   </url>\n//   <url>\n//     <loc>https://example.com/about</loc>\n//     <lastmod>2025-02-15</lastmod>\n//     <priority>0.8</priority>\n//   </url>\n// </urlset>`, `81783650806462680000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">export</span> <span class=\"token keyword\">default</span> <span class=\"token keyword\">function</span> <span class=\"token function\">sitemap</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">return</span> <span class=\"token punctuation\">[</span>\n    <span class=\"token punctuation\">{</span>\n      <span class=\"token literal-property property\">url</span><span class=\"token operator\">:</span> <span class=\"token string\">'https://example.com/'</span><span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">lastModified</span><span class=\"token operator\">:</span> <span class=\"token string\">'2025-03-01'</span><span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">priority</span><span class=\"token operator\">:</span> <span class=\"token number\">1.0</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">{</span>\n      <span class=\"token literal-property property\">url</span><span class=\"token operator\">:</span> <span class=\"token string\">'https://example.com/about'</span><span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">lastModified</span><span class=\"token operator\">:</span> <span class=\"token string\">'2025-02-15'</span><span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">priority</span><span class=\"token operator\">:</span> <span class=\"token number\">0.8</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">]</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Output:</span>\n\n<span class=\"token comment\">// &lt;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"token comment\">// &lt;urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"></span>\n<span class=\"token comment\">//   &lt;url></span>\n<span class=\"token comment\">//     &lt;loc>https://example.com/&lt;/loc></span>\n<span class=\"token comment\">//     &lt;lastmod>2025-03-01&lt;/lastmod></span>\n<span class=\"token comment\">//     &lt;priority>1.0&lt;/priority></span>\n<span class=\"token comment\">//   &lt;/url></span>\n<span class=\"token comment\">//   &lt;url></span>\n<span class=\"token comment\">//     &lt;loc>https://example.com/about&lt;/loc></span>\n<span class=\"token comment\">//     &lt;lastmod>2025-02-15&lt;/lastmod></span>\n<span class=\"token comment\">//     &lt;priority>0.8&lt;/priority></span>\n<span class=\"token comment\">//   &lt;/url></span>\n<span class=\"token comment\">// &lt;/urlset></span></code></pre></div>\n<p>This helps search engines discover and index all your important pages!</p>\n<h3 id=\"best-practices-for-metadata-management-\" style=\"position:relative;\"><a href=\"#best-practices-for-metadata-management-\" aria-label=\"best practices for metadata management  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Best Practices for Metadata Management 📌</h3>\n<p>To maximize the benefits of metadata management in Next.js (and metadata management in general), here are a few best practices to keep in mind:</p>\n<ul>\n<li><strong>Keep metadata concise and relevant:</strong> Ensure titles and descriptions are clear and to the point.</li>\n<li><strong>Utilize dynamic metadata when necessary:</strong> For pages with content that changes frequently, implement dynamic metadata to reflect the current state.</li>\n<li><strong>Leverage metadata templates:</strong> Use title templates to maintain consistency across pages.</li>\n<li><strong>Regularly update metadata:</strong> Keep metadata current to reflect any changes in content or branding.</li>\n<li><strong>Properly set Open Graph:</strong> Set Open Graph metadata correctly to improve how your content looks on social media, to boost engagement and clicks.</li>\n</ul>\n<h2 id=\"conclusion-\" style=\"position:relative;\"><a href=\"#conclusion-\" aria-label=\"conclusion  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Conclusion 🎯</h2>\n<p>Effective metadata management in Next.js is vital for SEO and user engagement. By understanding and implementing both static and dynamic metadata, leveraging inheritance, and following best practices, you can create apps that are both user-friendly and search-engine optimized.</p>\n<p>To deepen your Next.js knowledge, check out our article <a href=\"https://supertokens.com/blog/adding-login-to-your-nextjs-app-using-the-app-directory-and-supertokens\" target=\"_blank\" rel=\"nofollow\"><strong>“Securing your Next.js with Authentication”</strong></a>. It covers how Next.js handles rendering and authentication, explores various authentication strategies, and guides you through implementing an authentication solution in Next.js.</p>","frontmatter":{"date":"February 27, 2025","title":"Metadata in Next.js: Enhancing SEO and User Experience","cover":"metadata-in-nextjs.png","author":"Maria Shimkovska","description":"Learn how to effectively manage metadata in Next.js to boost SEO and improve user engagement through static and dynamic configurations."},"fields":{"slug":"/nextjs-metadata/"}},"site":{"siteMetadata":{"title":"SuperTokens Blog"}}},"pageContext":{"id":"e589d40c-8841-55cc-8be1-58e0e23754b0","fields__slug":"/nextjs-metadata/","__params":{"fields__slug":"nextjs-metadata"}}},
    "staticQueryHashes": []}