diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/index.test.ts.snap b/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/index.test.ts.snap index d3bca1a52bb76..7be5e23e0eca8 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/index.test.ts.snap +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/index.test.ts.snap @@ -43,6 +43,7 @@ Available document ids are: exports[`simple website content 1`] = ` { "description": "Images", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": { @@ -60,7 +61,6 @@ exports[`simple website content 1`] = ` "title": "baz", }, "id": "foo/baz", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -96,6 +96,7 @@ exports[`simple website content 1`] = ` exports[`simple website content 2`] = ` { "description": "Hi, Endilie here :)", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": { @@ -109,7 +110,6 @@ exports[`simple website content 2`] = ` "title": "Hello, World !", }, "id": "hello", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": undefined, @@ -142,6 +142,7 @@ exports[`simple website content 2`] = ` exports[`simple website content 3`] = ` { "description": "This is custom description", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": { @@ -152,7 +153,6 @@ exports[`simple website content 3`] = ` "title": "Bar", }, "id": "foo/bar", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": undefined, @@ -402,7 +402,7 @@ exports[`simple website content: data 1`] = ` \\"tags\\": [], \\"version\\": \\"current\\", \\"frontMatter\\": {}, - \\"isDraft\\": false + \\"draft\\": false }", "site-docs-draft-md-5b1.json": "{ \\"unversionedId\\": \\"draft\\", @@ -418,7 +418,7 @@ exports[`simple website content: data 1`] = ` \\"frontMatter\\": { \\"draft\\": true }, - \\"isDraft\\": false + \\"draft\\": false }", "site-docs-foo-bar-md-8c2.json": "{ \\"unversionedId\\": \\"foo/bar\\", @@ -438,7 +438,7 @@ exports[`simple website content: data 1`] = ` \\"pagination_next\\": null, \\"pagination_prev\\": null }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"docs\\" }", "site-docs-foo-baz-md-a69.json": "{ @@ -475,7 +475,7 @@ exports[`simple website content: data 1`] = ` } ] }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"docs\\", \\"previous\\": { \\"title\\": \\"Bar\\", @@ -498,7 +498,7 @@ exports[`simple website content: data 1`] = ` \\"tags\\": [], \\"version\\": \\"current\\", \\"frontMatter\\": {}, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"docs\\", \\"previous\\": { \\"title\\": \\"rootTryToEscapeSlug\\", @@ -539,7 +539,7 @@ exports[`simple website content: data 1`] = ` ], \\"slug\\": \\"/\\" }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"docs\\", \\"previous\\": { \\"title\\": \\"My heading as title\\", @@ -561,7 +561,7 @@ exports[`simple website content: data 1`] = ` \\"frontMatter\\": { \\"custom_edit_url\\": null }, - \\"isDraft\\": false + \\"draft\\": false }", "site-docs-lorem-md-b27.json": "{ \\"unversionedId\\": \\"lorem\\", @@ -579,7 +579,7 @@ exports[`simple website content: data 1`] = ` \\"custom_edit_url\\": \\"https://github.com/customUrl/docs/lorem.md\\", \\"unrelated_front_matter\\": \\"won't be part of metadata\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-docs-root-absolute-slug-md-db5.json": "{ \\"unversionedId\\": \\"rootAbsoluteSlug\\", @@ -597,7 +597,7 @@ exports[`simple website content: data 1`] = ` \\"pagination_next\\": \\"headingAsTitle\\", \\"pagination_prev\\": \\"foo/baz\\" }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"docs\\", \\"previous\\": { \\"title\\": \\"baz pagination_label\\", @@ -624,7 +624,7 @@ exports[`simple website content: data 1`] = ` \\"pagination_next\\": \\"headingAsTitle\\", \\"pagination_prev\\": \\"foo/baz\\" }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"docs\\", \\"previous\\": { \\"title\\": \\"baz pagination_label\\", @@ -651,7 +651,7 @@ exports[`simple website content: data 1`] = ` \\"pagination_next\\": \\"headingAsTitle\\", \\"pagination_prev\\": \\"foo/baz\\" }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"docs\\", \\"previous\\": { \\"title\\": \\"baz pagination_label\\", @@ -678,7 +678,7 @@ exports[`simple website content: data 1`] = ` \\"pagination_next\\": \\"headingAsTitle\\", \\"pagination_prev\\": \\"foo/baz\\" }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"docs\\", \\"previous\\": { \\"title\\": \\"baz pagination_label\\", @@ -703,7 +703,7 @@ exports[`simple website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"/absoluteSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-docs-slugs-relative-slug-md-d1c.json": "{ \\"unversionedId\\": \\"slugs/relativeSlug\\", @@ -719,7 +719,7 @@ exports[`simple website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"relativeSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-docs-slugs-resolved-slug-md-02b.json": "{ \\"unversionedId\\": \\"slugs/resolvedSlug\\", @@ -735,7 +735,7 @@ exports[`simple website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"./hey/ho/../resolvedSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-docs-slugs-try-to-escape-slug-md-70d.json": "{ \\"unversionedId\\": \\"slugs/tryToEscapeSlug\\", @@ -751,7 +751,7 @@ exports[`simple website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"../../../../../../../../tryToEscapeSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "tag-docs-tags-tag-1-b3f.json": "{ \\"name\\": \\"tag 1\\", @@ -1460,9 +1460,9 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "defaultSidebarItemsGenerator": [Function], "docs": [ { + "draft": false, "frontMatter": {}, "id": "API/Core APIs/Client API", - "isDraft": false, "sidebarPosition": 0, "source": "@site/docs/3-API/01_Core APIs/0 --- Client API.md", "sourceDirName": "3-API/01_Core APIs", @@ -1470,9 +1470,9 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "unversionedId": "API/Core APIs/Client API", }, { + "draft": false, "frontMatter": {}, "id": "API/Core APIs/Server API", - "isDraft": false, "sidebarPosition": 1, "source": "@site/docs/3-API/01_Core APIs/1 --- Server API.md", "sourceDirName": "3-API/01_Core APIs", @@ -1480,9 +1480,9 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "unversionedId": "API/Core APIs/Server API", }, { + "draft": false, "frontMatter": {}, "id": "API/Extension APIs/Plugin API", - "isDraft": false, "sidebarPosition": 0, "source": "@site/docs/3-API/02_Extension APIs/0. Plugin API.md", "sourceDirName": "3-API/02_Extension APIs", @@ -1490,9 +1490,9 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "unversionedId": "API/Extension APIs/Plugin API", }, { + "draft": false, "frontMatter": {}, "id": "API/Extension APIs/Theme API", - "isDraft": false, "sidebarPosition": 1, "source": "@site/docs/3-API/02_Extension APIs/1. Theme API.md", "sourceDirName": "3-API/02_Extension APIs", @@ -1500,9 +1500,9 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "unversionedId": "API/Extension APIs/Theme API", }, { + "draft": false, "frontMatter": {}, "id": "API/api-end", - "isDraft": false, "sidebarPosition": 3, "source": "@site/docs/3-API/03_api-end.md", "sourceDirName": "3-API", @@ -1510,9 +1510,9 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "unversionedId": "API/api-end", }, { + "draft": false, "frontMatter": {}, "id": "API/api-overview", - "isDraft": false, "sidebarPosition": 0, "source": "@site/docs/3-API/00_api-overview.md", "sourceDirName": "3-API", @@ -1520,12 +1520,12 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "unversionedId": "API/api-overview", }, { + "draft": false, "frontMatter": { "id": "guide1", "sidebar_position": 1, }, "id": "Guides/guide1", - "isDraft": false, "sidebarPosition": 1, "source": "@site/docs/Guides/z-guide1.md", "sourceDirName": "Guides", @@ -1533,11 +1533,11 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "unversionedId": "Guides/guide1", }, { + "draft": false, "frontMatter": { "id": "guide2", }, "id": "Guides/guide2", - "isDraft": false, "sidebarPosition": 2, "source": "@site/docs/Guides/02-guide2.md", "sourceDirName": "Guides", @@ -1545,12 +1545,12 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "unversionedId": "Guides/guide2", }, { + "draft": false, "frontMatter": { "id": "guide2.5", "sidebar_position": 2.5, }, "id": "Guides/guide2.5", - "isDraft": false, "sidebarPosition": 2.5, "source": "@site/docs/Guides/0-guide2.5.md", "sourceDirName": "Guides", @@ -1558,12 +1558,12 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "unversionedId": "Guides/guide2.5", }, { + "draft": false, "frontMatter": { "id": "guide3", "sidebar_position": 3, }, "id": "Guides/guide3", - "isDraft": false, "sidebarPosition": 3, "source": "@site/docs/Guides/guide3.md", "sourceDirName": "Guides", @@ -1571,11 +1571,11 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "unversionedId": "Guides/guide3", }, { + "draft": false, "frontMatter": { "id": "guide4", }, "id": "Guides/guide4", - "isDraft": false, "sidebarPosition": undefined, "source": "@site/docs/Guides/a-guide4.md", "sourceDirName": "Guides", @@ -1583,11 +1583,11 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "unversionedId": "Guides/guide4", }, { + "draft": false, "frontMatter": { "id": "guide5", }, "id": "Guides/guide5", - "isDraft": false, "sidebarPosition": undefined, "source": "@site/docs/Guides/b-guide5.md", "sourceDirName": "Guides", @@ -1595,9 +1595,9 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "unversionedId": "Guides/guide5", }, { + "draft": false, "frontMatter": {}, "id": "getting-started", - "isDraft": false, "sidebarPosition": 0, "source": "@site/docs/0-getting-started.md", "sourceDirName": ".", @@ -1605,9 +1605,9 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle "unversionedId": "getting-started", }, { + "draft": false, "frontMatter": {}, "id": "installation", - "isDraft": false, "sidebarPosition": 1, "source": "@site/docs/1-installation.md", "sourceDirName": ".", @@ -1631,11 +1631,11 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 1`] = ` { "description": "Getting started text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "getting-started", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -1659,11 +1659,11 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 2`] = ` { "description": "Installation text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "installation", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -1690,6 +1690,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 3`] = ` { "description": "Guide 1 text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": { @@ -1697,7 +1698,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "sidebar_position": 1, }, "id": "Guides/guide1", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -1724,13 +1724,13 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 4`] = ` { "description": "Guide 2 text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": { "id": "guide2", }, "id": "Guides/guide2", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -1757,6 +1757,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 5`] = ` { "description": "Guide 2.5 text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": { @@ -1764,7 +1765,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "sidebar_position": 2.5, }, "id": "Guides/guide2.5", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -1791,6 +1791,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 6`] = ` { "description": "Guide 3 text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": { @@ -1798,7 +1799,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "sidebar_position": 3, }, "id": "Guides/guide3", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -1825,13 +1825,13 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 7`] = ` { "description": "Guide 4 text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": { "id": "guide4", }, "id": "Guides/guide4", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -1858,13 +1858,13 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 8`] = ` { "description": "Guide 5 text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": { "id": "guide5", }, "id": "Guides/guide5", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -1891,11 +1891,11 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 9`] = ` { "description": "API Overview text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "API/api-overview", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -1922,11 +1922,11 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 10`] = ` { "description": "Client API text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "API/Core APIs/Client API", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -1953,11 +1953,11 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 11`] = ` { "description": "Server API text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "API/Core APIs/Server API", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -1984,11 +1984,11 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 12`] = ` { "description": "Plugin API text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "API/Extension APIs/Plugin API", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -2015,11 +2015,11 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 13`] = ` { "description": "Theme API text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "API/Extension APIs/Theme API", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -2046,11 +2046,11 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha exports[`site with full autogenerated sidebar docs in fully generated sidebar have correct metadata 14`] = ` { "description": "API End text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "API/api-end", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": undefined, @@ -2226,11 +2226,11 @@ exports[`site with partial autogenerated sidebars 2 (fix #4638) sidebar is parti exports[`site with partial autogenerated sidebars docs in partially generated sidebar have correct metadata 1`] = ` { "description": "API End text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "API/api-end", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -2254,11 +2254,11 @@ exports[`site with partial autogenerated sidebars docs in partially generated si exports[`site with partial autogenerated sidebars docs in partially generated sidebar have correct metadata 2`] = ` { "description": "API Overview text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "API/api-overview", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -2285,11 +2285,11 @@ exports[`site with partial autogenerated sidebars docs in partially generated si exports[`site with partial autogenerated sidebars docs in partially generated sidebar have correct metadata 3`] = ` { "description": "Plugin API text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "API/Extension APIs/Plugin API", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -2316,11 +2316,11 @@ exports[`site with partial autogenerated sidebars docs in partially generated si exports[`site with partial autogenerated sidebars docs in partially generated sidebar have correct metadata 4`] = ` { "description": "Theme API text", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "API/Extension APIs/Theme API", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": undefined, @@ -2376,13 +2376,13 @@ exports[`site with partial autogenerated sidebars sidebar is partially autogener exports[`versioned website (community) content 1`] = ` { "description": "Team current version (translated)", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": { "title": "Team title translated", }, "id": "team", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": undefined, @@ -2403,11 +2403,11 @@ exports[`versioned website (community) content 1`] = ` exports[`versioned website (community) content 2`] = ` { "description": "Team 1.0.0", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "version-1.0.0/team", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": undefined, @@ -2461,7 +2461,7 @@ exports[`versioned website (community) content: data 1`] = ` \\"tags\\": [], \\"version\\": \\"1.0.0\\", \\"frontMatter\\": {}, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"version-1.0.0/community\\" }", "site-i-18-n-en-docusaurus-plugin-content-docs-community-current-team-md-7e5.json": "{ @@ -2478,7 +2478,7 @@ exports[`versioned website (community) content: data 1`] = ` \\"frontMatter\\": { \\"title\\": \\"Team title translated\\" }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"community\\" }", "version-1-0-0-metadata-prop-608.json": "{ @@ -2656,6 +2656,7 @@ exports[`versioned website (community) getPathToWatch 1`] = ` exports[`versioned website content 1`] = ` { "description": "This is next version of bar.", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": { @@ -2670,7 +2671,6 @@ exports[`versioned website content 1`] = ` ], }, "id": "foo/bar", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -2707,11 +2707,11 @@ exports[`versioned website content 1`] = ` exports[`versioned website content 2`] = ` { "description": "Bar 1.0.1 !", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "version-1.0.1/foo/bar", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -2735,13 +2735,13 @@ exports[`versioned website content 2`] = ` exports[`versioned website content 3`] = ` { "description": "Hello next !", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": { "slug": "/", }, "id": "hello", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": undefined, @@ -2765,13 +2765,13 @@ exports[`versioned website content 3`] = ` exports[`versioned website content 4`] = ` { "description": "Hello 1.0.1 !", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": { "slug": "/", }, "id": "version-1.0.1/hello", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": undefined, @@ -2795,11 +2795,11 @@ exports[`versioned website content 4`] = ` exports[`versioned website content 5`] = ` { "description": "Baz 1.0.0 ! This will be deleted in next subsequent versions.", + "draft": false, "editUrl": undefined, "formattedLastUpdatedAt": undefined, "frontMatter": {}, "id": "version-1.0.0/foo/baz", - "isDraft": false, "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, "next": { @@ -2963,7 +2963,7 @@ exports[`versioned website content: data 1`] = ` } ] }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"docs\\", \\"next\\": { \\"title\\": \\"hello\\", @@ -2984,7 +2984,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"/\\" }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"docs\\", \\"previous\\": { \\"title\\": \\"bar\\", @@ -3005,7 +3005,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"/absoluteSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-docs-slugs-relative-slug-md-d1c.json": "{ \\"unversionedId\\": \\"slugs/relativeSlug\\", @@ -3021,7 +3021,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"relativeSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-docs-slugs-resolved-slug-md-02b.json": "{ \\"unversionedId\\": \\"slugs/resolvedSlug\\", @@ -3037,7 +3037,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"./hey/ho/../resolvedSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-docs-slugs-try-to-escape-slug-md-70d.json": "{ \\"unversionedId\\": \\"slugs/tryToEscapeSlug\\", @@ -3053,7 +3053,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"../../../../../../../../tryToEscapeSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-i-18-n-en-docusaurus-plugin-content-docs-version-1-0-0-hello-md-fe5.json": "{ \\"unversionedId\\": \\"hello\\", @@ -3069,7 +3069,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"/\\" }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"version-1.0.0/docs\\", \\"previous\\": { \\"title\\": \\"baz\\", @@ -3090,7 +3090,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"barSlug\\" }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"version-1.0.0/docs\\", \\"next\\": { \\"title\\": \\"baz\\", @@ -3109,7 +3109,7 @@ exports[`versioned website content: data 1`] = ` \\"tags\\": [], \\"version\\": \\"1.0.0\\", \\"frontMatter\\": {}, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"version-1.0.0/docs\\", \\"previous\\": { \\"title\\": \\"bar\\", @@ -3132,7 +3132,7 @@ exports[`versioned website content: data 1`] = ` \\"tags\\": [], \\"version\\": \\"1.0.1\\", \\"frontMatter\\": {}, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"VersionedSideBarNameDoesNotMatter/docs\\", \\"next\\": { \\"title\\": \\"hello\\", @@ -3153,7 +3153,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"/\\" }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"VersionedSideBarNameDoesNotMatter/docs\\", \\"previous\\": { \\"title\\": \\"bar\\", @@ -3174,7 +3174,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"/rootAbsoluteSlug\\" }, - \\"isDraft\\": false, + \\"draft\\": false, \\"sidebar\\": \\"version-1.0.1/docs\\" }", "site-versioned-docs-version-with-slugs-root-relative-slug-md-32a.json": "{ @@ -3191,7 +3191,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"rootRelativeSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-versioned-docs-version-with-slugs-root-resolved-slug-md-aee.json": "{ \\"unversionedId\\": \\"rootResolvedSlug\\", @@ -3207,7 +3207,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"./hey/ho/../rootResolvedSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-versioned-docs-version-with-slugs-root-try-to-escape-slug-md-b5d.json": "{ \\"unversionedId\\": \\"rootTryToEscapeSlug\\", @@ -3223,7 +3223,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"../../../../../../../../rootTryToEscapeSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-versioned-docs-version-with-slugs-slugs-absolute-slug-md-47a.json": "{ \\"unversionedId\\": \\"slugs/absoluteSlug\\", @@ -3239,7 +3239,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"/absoluteSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-versioned-docs-version-with-slugs-slugs-relative-slug-md-a95.json": "{ \\"unversionedId\\": \\"slugs/relativeSlug\\", @@ -3255,7 +3255,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"relativeSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-versioned-docs-version-with-slugs-slugs-resolved-slug-md-5a1.json": "{ \\"unversionedId\\": \\"slugs/resolvedSlug\\", @@ -3271,7 +3271,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"./hey/ho/../resolvedSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "site-versioned-docs-version-with-slugs-slugs-try-to-escape-slug-md-4e1.json": "{ \\"unversionedId\\": \\"slugs/tryToEscapeSlug\\", @@ -3287,7 +3287,7 @@ exports[`versioned website content: data 1`] = ` \\"frontMatter\\": { \\"slug\\": \\"../../../../../../../../tryToEscapeSlug\\" }, - \\"isDraft\\": false + \\"draft\\": false }", "tag-docs-next-tags-bar-tag-1-a8f.json": "{ \\"name\\": \\"barTag 1\\", diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts index 1948287063812..57c0ad8b7046d 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts @@ -241,7 +241,7 @@ describe('simple site', () => { pagination_prev: null, }, tags: [], - isDraft: false, + draft: false, }); await defaultTestUtils.testMeta(path.join('hello.md'), { version: 'current', @@ -269,7 +269,7 @@ describe('simple site', () => { permalink: '/docs/tags/tag-3', }, ], - isDraft: false, + draft: false, }); }); @@ -319,7 +319,7 @@ describe('simple site', () => { permalink: '/docs/tags/tag2-custom-permalink', }, ], - isDraft: false, + draft: false, }); }); @@ -341,7 +341,7 @@ describe('simple site', () => { unrelated_front_matter: "won't be part of metadata", }, tags: [], - isDraft: false, + draft: false, }); }); @@ -394,7 +394,7 @@ describe('simple site', () => { permalink: '/docs/tags/tag2-custom-permalink', }, ], - isDraft: false, + draft: false, }); expect(editUrlFunction).toHaveBeenCalledTimes(1); @@ -440,7 +440,7 @@ describe('simple site', () => { formattedLastUpdatedAt: '10/14/2018', lastUpdatedBy: 'Author', tags: [], - isDraft: false, + draft: false, }); }); @@ -465,7 +465,7 @@ describe('simple site', () => { draft: true, }, tags: [], - isDraft: true, + draft: true, }); }); @@ -649,7 +649,7 @@ describe('versioned site', () => { permalink: '/docs/next/tags/barTag-3-permalink', }, ], - isDraft: false, + draft: false, }); await currentVersionTestUtils.testMeta(path.join('hello.md'), { id: 'hello', @@ -664,7 +664,7 @@ describe('versioned site', () => { slug: '/', }, tags: [], - isDraft: false, + draft: false, }); }); @@ -682,7 +682,7 @@ describe('versioned site', () => { frontMatter: {slug: 'barSlug'}, version: '1.0.0', tags: [], - isDraft: false, + draft: false, }); await version100TestUtils.testMeta(path.join('hello.md'), { id: 'version-1.0.0/hello', @@ -699,7 +699,7 @@ describe('versioned site', () => { source: '@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md', tags: [], - isDraft: false, + draft: false, }); await version101TestUtils.testMeta(path.join('foo', 'bar.md'), { id: 'version-1.0.1/foo/bar', @@ -712,7 +712,7 @@ describe('versioned site', () => { version: '1.0.1', frontMatter: {}, tags: [], - isDraft: false, + draft: false, }); await version101TestUtils.testMeta(path.join('hello.md'), { id: 'version-1.0.1/hello', @@ -727,7 +727,7 @@ describe('versioned site', () => { slug: '/', }, tags: [], - isDraft: false, + draft: false, }); }); @@ -824,7 +824,7 @@ describe('versioned site', () => { '@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md', editUrl: hardcodedEditUrl, tags: [], - isDraft: false, + draft: false, }); expect(editUrlFunction).toHaveBeenCalledTimes(1); @@ -869,7 +869,7 @@ describe('versioned site', () => { editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/versioned_docs/version-1.0.0/hello.md', tags: [], - isDraft: false, + draft: false, }); }); @@ -905,7 +905,7 @@ describe('versioned site', () => { editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/docs/hello.md', tags: [], - isDraft: false, + draft: false, }); }); @@ -942,7 +942,7 @@ describe('versioned site', () => { editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md', tags: [], - isDraft: false, + draft: false, }); }); @@ -980,7 +980,7 @@ describe('versioned site', () => { editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/i18n/fr/docusaurus-plugin-content-docs/current/hello.md', tags: [], - isDraft: false, + draft: false, }); }); }); diff --git a/packages/docusaurus-plugin-content-docs/src/docs.ts b/packages/docusaurus-plugin-content-docs/src/docs.ts index de46ce3ea3b66..2e6fca68ebb18 100644 --- a/packages/docusaurus-plugin-content-docs/src/docs.ts +++ b/packages/docusaurus-plugin-content-docs/src/docs.ts @@ -131,7 +131,7 @@ function doProcessDocMetadata({ } = parseMarkdownString(content); const frontMatter = validateDocFrontMatter(unsafeFrontMatter); - const isDraft = + const draft = (frontMatter.draft && process.env.NODE_ENV === 'production') || false; const { @@ -263,7 +263,7 @@ function doProcessDocMetadata({ : undefined, sidebarPosition, frontMatter, - isDraft, + draft, }; } diff --git a/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts b/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts index db0ec9e101432..3087821f24fe1 100644 --- a/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts +++ b/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts @@ -407,7 +407,7 @@ declare module '@docusaurus/plugin-content-docs' { /** Front matter, as-is. */ frontMatter: DocFrontMatter & {[key: string]: unknown}; /** Is the doc going to be excluded from production builds? */ - isDraft: boolean; + draft: boolean; }; export type DocMetadata = DocMetadataBase & diff --git a/packages/docusaurus-plugin-content-docs/src/routes.ts b/packages/docusaurus-plugin-content-docs/src/routes.ts index c76783046aca1..0b7f60c7e7296 100644 --- a/packages/docusaurus-plugin-content-docs/src/routes.ts +++ b/packages/docusaurus-plugin-content-docs/src/routes.ts @@ -71,7 +71,7 @@ export async function createDocRoutes({ }): Promise { return Promise.all( docs - .filter((metadataItem) => !metadataItem.isDraft) + .filter((metadataItem) => !metadataItem.draft) .map(async (metadataItem) => { await actions.createData( // Note that this created data path must be in sync with diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/generator.test.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/generator.test.ts index 840fc8607fc0c..ef8fda6d7ff61 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/generator.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/generator.test.ts @@ -526,7 +526,7 @@ describe('DefaultSidebarItemsGenerator', () => { frontMatter: { draft: true, }, - isDraft: true, + draft: true, }, { id: 'doc2', @@ -536,7 +536,7 @@ describe('DefaultSidebarItemsGenerator', () => { frontMatter: { draft: false, }, - isDraft: false, + draft: false, }, ], options: { diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/processor.test.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/processor.test.ts index deb654591f506..5c1e2ad5e3a9a 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/processor.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/processor.test.ts @@ -263,11 +263,11 @@ describe('processSidebars', () => { docs: [ { id: 'doc1', - isDraft: true, + draft: true, }, { id: 'doc2', - isDraft: false, + draft: false, }, ], }, diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/generator.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/generator.ts index 115b1bd6c08b3..4cf2d98643b49 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/generator.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/generator.ts @@ -53,7 +53,7 @@ export const DefaultSidebarItemsGenerator: SidebarItemsGenerator = async ({ item: {dirName: autogenDir}, categoriesMetadata, }) => { - const visibleDocs = allDocs.filter((doc) => !doc.isDraft); + const visibleDocs = allDocs.filter((doc) => !doc.draft); const docsById = createDocsByIdIndex(visibleDocs); const findDoc = (docId: string): SidebarItemsGeneratorDoc | undefined => docsById[docId]; diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/processor.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/processor.ts index 7a943d9f08ec8..81979d04b89b6 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/processor.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/processor.ts @@ -39,7 +39,7 @@ function toSidebarItemsGeneratorDoc( 'source', 'sourceDirName', 'sidebarPosition', - 'isDraft', + 'draft', ]); } @@ -96,10 +96,7 @@ async function processSidebar( if (item.type === 'autogenerated') { return processAutoGeneratedItem(item); } - if ( - item.type === 'doc' && - docs.find((doc) => doc.id === item.id)?.isDraft - ) { + if (item.type === 'doc' && docs.find((doc) => doc.id === item.id)?.draft) { return []; } return [item]; diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/types.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/types.ts index e5c63d1f05a99..d4af8e528010d 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/types.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/types.ts @@ -227,7 +227,7 @@ export type SidebarItemsGeneratorDoc = Pick< | 'source' | 'sourceDirName' | 'sidebarPosition' - | 'isDraft' + | 'draft' >; export type SidebarItemsGeneratorVersion = Pick< VersionMetadata,