"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["46154"],{87877:function(e,n,t){t.d(n,{Z:()=>a});let a=t.p+"assets/images/docusaurus-asset-example-banner-63decf1180b7949f4c3d0f7b7ecfd162.png"},78569:function(e,n,t){t.r(n),t.d(n,{default:()=>u,frontMatter:()=>r,metadata:()=>a,assets:()=>d,toc:()=>l,contentTitle:()=>c});var a=JSON.parse('{"id":"seo","title":"Search engine optimization (SEO)","description":"How to make your Docusaurus site maximally search-engine-friendly.","source":"@site/docs/seo.mdx","sourceDirName":".","slug":"/seo","permalink":"/docs/seo","draft":false,"unlisted":false,"editUrl":"https://github.com/facebook/docusaurus/edit/main/website/docs/seo.mdx","tags":[],"version":"current","lastUpdatedBy":"Taras","lastUpdatedAt":1739715779000,"frontMatter":{"description":"How to make your Docusaurus site maximally search-engine-friendly.","sidebar_label":"SEO","keywords":["seo","positioning"]},"sidebar":"docs","previous":{"title":"Browser support","permalink":"/docs/browser-support"},"next":{"title":"Using Plugins","permalink":"/docs/using-plugins"}}'),s=t(85893),o=t(80980),i=t(14522);let r={description:"How to make your Docusaurus site maximally search-engine-friendly.",sidebar_label:"SEO",keywords:["seo","positioning"]},c="Search engine optimization (SEO)",d={},l=[{value:"Global metadata",id:"global-metadata",level:2},{value:"Single page metadata",id:"single-page-metadata",level:2},{value:"Static HTML generation",id:"static-html-generation",level:2},{value:"Image meta description",id:"image-meta-description",level:2},{value:"Rich search information",id:"rich-search-information",level:2},{value:"Robots file",id:"robots-file",level:2},{value:"Sitemap file",id:"sitemap-file",level:2},{value:"Human readable links",id:"human-readable-links",level:2},{value:"Structured content",id:"structured-content",level:2}];function h(e){let n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",header:"header",img:"img",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"search-engine-optimization-seo",children:"Search engine optimization (SEO)"})}),"\n","\n",(0,s.jsx)(n.p,{children:"Docusaurus supports search engine optimization in a variety of ways."}),"\n",(0,s.jsx)(n.h2,{id:"global-metadata",children:"Global metadata"}),"\n",(0,s.jsxs)(n.p,{children:["Provide global meta attributes for the entire site through the ",(0,s.jsx)(n.a,{href:"/docs/configuration#site-metadata",children:"site configuration"}),". The metadata will all be rendered in the HTML ",(0,s.jsx)(n.code,{children:""})," using the key-value pairs as the prop name and value. The ",(0,s.jsx)(n.code,{children:"metadata"})," attribute is a convenient shortcut to declare ",(0,s.jsx)(n.code,{children:""})," tags, but it is also possible to inject arbitrary tags in ",(0,s.jsx)(n.code,{children:""})," with the ",(0,s.jsx)(n.code,{children:"headTags"})," attribute."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",metastring:'title="docusaurus.config.js"',children:"export default {\n themeConfig: {\n // Declare some tags\n metadata: [\n {name: 'keywords', content: 'cooking, blog'},\n {name: 'twitter:card', content: 'summary_large_image'},\n ],\n },\n headTags: [\n // Declare a preconnect tag\n {\n tagName: 'link',\n attributes: {\n rel: 'preconnect',\n href: 'https://example.com',\n },\n },\n // Declare some json-ld structured data\n {\n tagName: 'script',\n attributes: {\n type: 'application/ld+json',\n },\n innerHTML: JSON.stringify({\n '@context': 'https://schema.org/',\n '@type': 'Organization',\n name: 'Meta Open Source',\n url: 'https://opensource.fb.com/',\n logo: 'https://opensource.fb.com/img/logos/Meta-Open-Source.svg',\n }),\n },\n ],\n};\n"})}),"\n",(0,s.jsxs)(n.p,{children:["Docusaurus adds some metadata out-of-the-box. For example, if you have configured ",(0,s.jsx)(n.a,{href:"/docs/i18n/introduction",children:"i18n"}),", you will get a ",(0,s.jsx)(n.a,{href:"https://developers.google.com/search/docs/advanced/crawling/localized-versions",children:(0,s.jsx)(n.code,{children:"hreflang"})})," alternate link."]}),"\n",(0,s.jsxs)(n.p,{children:["To read more about types of meta tags, visit ",(0,s.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta",children:"the MDN docs"}),"."]}),"\n",(0,s.jsx)(n.h2,{id:"single-page-metadata",children:"Single page metadata"}),"\n",(0,s.jsxs)(n.p,{children:["Similar to ",(0,s.jsx)(n.a,{href:"#global-metadata",children:"global metadata"}),", Docusaurus also allows for the addition of meta-information to individual pages. Follow ",(0,s.jsx)(n.a,{href:"/docs/markdown-features/head-metadata",children:"this guide"})," for configuring the ",(0,s.jsx)(n.code,{children:""})," tag. In short:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-md",metastring:'title="my-markdown-page.mdx"',children:"# A cooking guide\n\n\n \n \n \n