"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["12837"],{98171:function(e,t,n){n.d(t,{Z:function(){return r}});let r=n.p+"assets/images/social-card-8ca15c1adaeb77ca302178575136a0b6.png"},93837:function(e,t,n){n.d(t,{Z:function(){return r}});let r=n.p+"assets/images/social-card-8ca15c1adaeb77ca302178575136a0b6.png"},55665:function(e,t,n){n.r(t),n.d(t,{assets:function(){return l},contentTitle:function(){return i},default:function(){return u},frontMatter:function(){return a},metadata:function(){return r},toc:function(){return c}});var r=n(3813),s=n(24246),o=n(80980);n(14522),n(51118),n(39468);let a={title:"Docusaurus 3.2",authors:["slorber"],tags:["release"],image:"./img/social-card.png",date:new Date("2024-03-29T00:00:00.000Z")},i=void 0,l={image:n(98171).Z,authorsImageUrls:[void 0]},c=[{value:"Highlights",id:"highlights",level:2},{value:"Faster builds",id:"faster-builds",level:3},{value:"Faster Dev Server",id:"faster-dev-server",level:3},{value:"MDX partials table-of-contents",id:"mdx-partials-table-of-contents",level:3},{value:"Blog improvements",id:"blog-improvements",level:3},{value:"Sitemap lastmod",id:"sitemap-lastmod",level:3},{value:"Other changes",id:"other-changes",level:2}];function d(e){let t={a:"a",code:"code",h2:"h2",h3:"h3",img:"img",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.a)(),...e.components},{Details:r}=t;return!r&&function(e,t){throw Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Details",!0),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:["We are happy to announce ",(0,s.jsx)(t.strong,{children:"Docusaurus 3.2"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["The upgrade should be easy: as explained in our ",(0,s.jsx)(t.a,{href:"/community/release-process",children:"release process documentation"}),", minor versions respect ",(0,s.jsx)(t.a,{href:"https://semver.org/",children:"Semantic Versioning"}),"."]}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.img,{alt:"Docusaurus blog post social card",src:n(93837).Z+"",width:"1200",height:"600"})}),"\n","\n",(0,s.jsx)(t.h2,{id:"highlights",children:"Highlights"}),"\n",(0,s.jsx)(t.h3,{id:"faster-builds",children:"Faster builds"}),"\n",(0,s.jsx)(t.p,{children:"We worked hard to reduce the time it takes to build a Docusaurus site in production mode."}),"\n",(0,s.jsx)(t.p,{children:"Between v3.1.0 and v3.2.0, several changes have been made, leading to significantly faster production builds for many sites."}),"\n",(0,s.jsxs)(t.p,{children:["Let's take an example. Our benchmark on the ",(0,s.jsx)(t.a,{href:"https://github.com/facebook/react-native-website/pull/4072",children:"React Native website upgrading to v3.2"})," reports the following results:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"\uD83D\uDD25 Cold builds: 95s \u27A1\uFE0F 66s (~30% faster)"}),"\n",(0,s.jsx)(t.li,{children:"\uD83D\uDD25 Incremental builds: 55s \u27A1\uFE0F 22s (~60% faster)"}),"\n"]}),"\n",(0,s.jsx)(t.p,{children:"The results will vary depending on your site's topology and the options you turned on, but we expect the largest sites will see the most significant improvements."}),"\n",(0,s.jsxs)(t.p,{children:["Note that this is only the beginning, and Docusaurus performance can still be significantly improved, notably the bundling time and the memory consumption. Track our ",(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/issues/4765",children:"performance issue"})," for upcoming improvements."]}),"\n",(0,s.jsxs)(r,{children:[(0,s.jsx)("summary",{children:"What is the difference between a cold build and an incremental build?"}),(0,s.jsxs)(t.p,{children:["A cold build is when the Docusaurus caches are empty, generally after running ",(0,s.jsx)(t.code,{children:"docusaurus clear"}),"."]}),(0,s.jsxs)(t.p,{children:["An incremental build happens when you run another time the ",(0,s.jsx)(t.code,{children:"docusaurus build"}),' command. Docusaurus automatically tries to "re-use" computations from former builds to make subsequent builds faster. In practice it\'s based on ',(0,s.jsx)(t.a,{href:"https://webpack.js.org/guides/build-performance/#persistent-cache",children:"Webpack persistent caching"}),". To enable incremental builds on your CI server, you can persist the ",(0,s.jsx)(t.code,{children:"node_modules/.cache"})," folder across builds."]})]}),"\n",(0,s.jsx)(t.h3,{id:"faster-dev-server",children:"Faster Dev Server"}),"\n",(0,s.jsx)(t.p,{children:"We also worked on improving the performance of the dev server, so that you can get a faster feedback when editing Markdown/MDX files."}),"\n",(0,s.jsx)(t.p,{children:"The way we initially implemented content reloading wasn't great. For example, editing a blog post file would also trigger a useless reload of the unrelated docs plugin. From now on, when editing a plugin's content, only that plugin will reload. It's hard to measure precisely the impact of this change, but I estimate edits should appear in your browser at least 50% faster \uD83D\uDD25."}),"\n",(0,s.jsx)(t.p,{children:"We plan to keep improving the speed of our dev server, with even more granular hot reloads, ensuring we don't run useless computations that would always keep giving the same result."}),"\n",(0,s.jsx)(t.h3,{id:"mdx-partials-table-of-contents",children:"MDX partials table-of-contents"}),"\n",(0,s.jsxs)(t.p,{children:["With ",(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9684",children:"#9684"}),", Docusaurus is now able to render headings coming from an imported partial into the table-of-contents."]}),"\n",(0,s.jsxs)(t.p,{children:["Docusaurus and MDX allows you to ",(0,s.jsx)(t.a,{href:"/docs/markdown-features/react#importing-markdown",children:"import one Markdown file into another"}),'. We usually call the imported Markdown file a "partial", and use the ',(0,s.jsx)(t.code,{children:"_"})," prefix so that this file does not lead to the creation of a new page."]}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-md",metastring:'title="myDoc.mdx"',children:"# My Doc\n\n## Doc heading\n\nContent is imported from another MDX file:\n\nimport ImportedDoc from './\\_importedDoc.mdx';\n\n\n"})}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-md",metastring:'title="_myPartial.mdx"',children:"## Partial heading\n\nSome paragraph\n"})}),"\n",(0,s.jsxs)(t.p,{children:["Previously, the heading ",(0,s.jsx)(t.code,{children:"Partial heading"})," did not appear in the table-of-contents, but now it will!"]}),"\n",(0,s.jsx)(t.h3,{id:"blog-improvements",children:"Blog improvements"}),"\n",(0,s.jsx)(t.p,{children:"We improved the blog plugin with several new options to make it even more powerful and flexible:"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9912",children:"#9912"}),": you can now display the last update time and author of a blog post, a feature the docs plugin already had."]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9886",children:"#9886"}),": a new ",(0,s.jsx)(t.code,{children:"processBlogPosts"})," option allow you to filter/transform/sort blog posts."]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9838",children:"#9838"}),": a new ",(0,s.jsx)(t.code,{children:"pageBasePath"})," option allows you to customize the blog pagination URL segment (",(0,s.jsx)(t.code,{children:"/blog/page/2"}),")"]}),"\n"]}),"\n",(0,s.jsx)(t.h3,{id:"sitemap-lastmod",children:"Sitemap lastmod"}),"\n",(0,s.jsxs)(t.p,{children:["With ",(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9954",children:"#9954"}),", the sitemap plugin has a new ",(0,s.jsx)(t.code,{children:"lastmod"})," option that can now emit a ",(0,s.jsx)(t.code,{children:""})," tag on the XML. The value is read from the Git history by default, but can be overridden with docs and blog ",(0,s.jsx)(t.code,{children:"last_update"})," front matter."]}),"\n",(0,s.jsxs)(t.p,{children:["We also made it possible to opt-out of emitting ",(0,s.jsx)(t.code,{children:""})," and ",(0,s.jsx)(t.code,{children:""})," tags, which are generally ignored by crawlers (notably ",(0,s.jsx)(t.a,{href:"https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping",children:"Google"}),")."]}),"\n",(0,s.jsx)(t.p,{children:"We recommend using the following sitemap plugin config, that will become the default in Docusaurus V4:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",children:"{\n lastmod: 'date',\n priority: null,\n changefreq: null,\n}\n"})}),"\n",(0,s.jsx)(t.h2,{id:"other-changes",children:"Other changes"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9687",children:"#9687"}),": new Vercel Analytics plugin"]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9681",children:"#9681"})," and ",(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9442",children:"#9442"}),": ",(0,s.jsx)(t.code,{children:"docusaurus swizzle"})," and ",(0,s.jsx)(t.code,{children:"create-docusaurus"})," CLIs now ask users if they prefer to use TypeScript"]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9928",children:"#9928"}),": new Icelandic translation"]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9931",children:"#9928"}),": new ",(0,s.jsx)(t.code,{children:"allContentLoaded"})," plugin lifecycle (experimental)"]}),"\n"]}),"\n",(0,s.jsxs)(t.p,{children:["Check the ",(0,s.jsx)(t.strong,{children:(0,s.jsx)(t.a,{href:"/changelog/3.2.0",children:"3.2.0 changelog entry"})})," for an exhaustive list of changes."]})]})}function u(e={}){let{wrapper:t}={...(0,o.a)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},51118:function(e,t,n){n.d(t,{Z:function(){return o}});var r=n(24246);n(27378);var s=n(14522);function o(e){var t=e.url;return(0,r.jsx)("div",{style:{padding:10},children:(0,r.jsx)(s.Z,{url:t,style:{minWidth:"min(100%,45vw)",width:800,maxWidth:"100%",overflow:"hidden"},bodyStyle:{padding:0},children:(0,r.jsx)("iframe",{src:t,title:t,style:{display:"block",width:"100%",height:300}})})})}},14522:function(e,t,n){n.d(t,{Z:()=>p});var r=n("24246");n("27378");var s=n("90496");let o="browserWindow_my1Q",a="browserWindowHeader_jXSR",i="buttons_uHc7",l="browserWindowAddressBar_Pd8y",c="dot_giz1",d="browserWindowMenuIcon_Vhuh",u="bar_rrRL",h="browserWindowBody_Idgs";function p(e){var t,n,p=e.children,m=e.minHeight,g=e.url,f=e.style,b=e.bodyStyle;return(0,r.jsxs)("div",{className:o,style:(t=function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n