chore(plugin-docs): remove legacy versioned prefix on doc ids and sidebar names in versioned sidebars (#9310)

This commit is contained in:
Sébastien Lorber 2023-09-15 18:52:42 +02:00 committed by GitHub
parent f5ae537d3e
commit 598b32011f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 264 additions and 396 deletions

View file

@ -1,3 +1,3 @@
{ {
"version-1.0.0/community": ["version-1.0.0/team"] "community": ["team"]
} }

View file

@ -1,11 +1,11 @@
{ {
"version-1.0.0/docs": { "docs": {
"Test": [ "Test": [
"version-1.0.0/foo/bar", "foo/bar",
"version-1.0.0/foo/baz" "foo/baz"
], ],
"Guides": [ "Guides": [
"version-1.0.0/hello" "hello"
] ]
} }
} }

View file

@ -4,7 +4,7 @@
"foo/bar" "foo/bar"
], ],
"Guides": [ "Guides": [
"version-1.0.1/hello" "hello"
] ]
} }
} }

View file

@ -1,5 +1,5 @@
{ {
"version-1.0.1/docs": { "docs": {
"Test": ["version-withSlugs/rootAbsoluteSlug"] "Test": ["rootAbsoluteSlug"]
} }
} }

View file

@ -43,7 +43,8 @@ Available document ids are:
- slugs/resolvedSlug - slugs/resolvedSlug
- slugs/tryToEscapeSlug - slugs/tryToEscapeSlug
- unlisted-category/unlisted-category-doc - unlisted-category/unlisted-category-doc
- unlisted-category/unlisted-category-index" - unlisted-category/unlisted-category-index
"
`; `;
exports[`simple website content 1`] = ` exports[`simple website content 1`] = `
@ -95,7 +96,6 @@ exports[`simple website content 1`] = `
], ],
"title": "baz", "title": "baz",
"unlisted": false, "unlisted": false,
"unversionedId": "foo/baz",
"version": "current", "version": "current",
} }
`; `;
@ -142,7 +142,6 @@ exports[`simple website content 2`] = `
], ],
"title": "Hello, World !", "title": "Hello, World !",
"unlisted": false, "unlisted": false,
"unversionedId": "hello",
"version": "current", "version": "current",
} }
`; `;
@ -174,7 +173,6 @@ exports[`simple website content 3`] = `
"tags": [], "tags": [],
"title": "Bar", "title": "Bar",
"unlisted": false, "unlisted": false,
"unversionedId": "foo/bar",
"version": "current", "version": "current",
} }
`; `;
@ -451,7 +449,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-custom-last-update-md-b8d.json": "{ "site-docs-custom-last-update-md-b8d.json": "{
"unversionedId": "customLastUpdate",
"id": "customLastUpdate", "id": "customLastUpdate",
"title": "Custom Last Update", "title": "Custom Last Update",
"description": "Custom last update", "description": "Custom last update",
@ -472,7 +469,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-doc-draft-md-584.json": "{ "site-docs-doc-draft-md-584.json": "{
"unversionedId": "doc-draft",
"id": "doc-draft", "id": "doc-draft",
"title": "doc-draft", "title": "doc-draft",
"description": "This is a draft document", "description": "This is a draft document",
@ -489,7 +485,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-doc-unlisted-md-80b.json": "{ "site-docs-doc-unlisted-md-80b.json": "{
"unversionedId": "doc-unlisted",
"id": "doc-unlisted", "id": "doc-unlisted",
"title": "doc-unlisted", "title": "doc-unlisted",
"description": "This is an unlisted document", "description": "This is an unlisted document",
@ -515,7 +510,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-doc-with-space-md-e90.json": "{ "site-docs-doc-with-space-md-e90.json": "{
"unversionedId": "doc with space",
"id": "doc with space", "id": "doc with space",
"title": "Hoo hoo, if this path tricks you...", "title": "Hoo hoo, if this path tricks you...",
"description": "", "description": "",
@ -530,7 +524,6 @@ exports[`simple website content: data 1`] = `
"frontMatter": {} "frontMatter": {}
}", }",
"site-docs-foo-bar-md-8c2.json": "{ "site-docs-foo-bar-md-8c2.json": "{
"unversionedId": "foo/bar",
"id": "foo/bar", "id": "foo/bar",
"title": "Bar", "title": "Bar",
"description": "This is custom description", "description": "This is custom description",
@ -552,7 +545,6 @@ exports[`simple website content: data 1`] = `
"sidebar": "docs" "sidebar": "docs"
}", }",
"site-docs-foo-baz-md-a69.json": "{ "site-docs-foo-baz-md-a69.json": "{
"unversionedId": "foo/baz",
"id": "foo/baz", "id": "foo/baz",
"title": "baz", "title": "baz",
"description": "Images", "description": "Images",
@ -598,7 +590,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-heading-as-title-md-c6d.json": "{ "site-docs-heading-as-title-md-c6d.json": "{
"unversionedId": "headingAsTitle",
"id": "headingAsTitle", "id": "headingAsTitle",
"title": "My heading as title", "title": "My heading as title",
"description": "", "description": "",
@ -622,7 +613,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-hello-md-9df.json": "{ "site-docs-hello-md-9df.json": "{
"unversionedId": "hello",
"id": "hello", "id": "hello",
"title": "Hello, World !", "title": "Hello, World !",
"description": "Hi, Endilie here :)", "description": "Hi, Endilie here :)",
@ -660,7 +650,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-ipsum-md-c61.json": "{ "site-docs-ipsum-md-c61.json": "{
"unversionedId": "ipsum",
"id": "ipsum", "id": "ipsum",
"title": "ipsum", "title": "ipsum",
"description": "Lorem ipsum.", "description": "Lorem ipsum.",
@ -683,7 +672,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-last-update-author-only-md-352.json": "{ "site-docs-last-update-author-only-md-352.json": "{
"unversionedId": "lastUpdateAuthorOnly",
"id": "lastUpdateAuthorOnly", "id": "lastUpdateAuthorOnly",
"title": "Last Update Author Only", "title": "Last Update Author Only",
"description": "Only custom author, so it will still use the date from Git", "description": "Only custom author, so it will still use the date from Git",
@ -703,7 +691,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-last-update-date-only-md-987.json": "{ "site-docs-last-update-date-only-md-987.json": "{
"unversionedId": "lastUpdateDateOnly",
"id": "lastUpdateDateOnly", "id": "lastUpdateDateOnly",
"title": "Last Update Date Only", "title": "Last Update Date Only",
"description": "Only custom date, so it will still use the author from Git", "description": "Only custom date, so it will still use the author from Git",
@ -723,7 +710,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-lorem-md-b27.json": "{ "site-docs-lorem-md-b27.json": "{
"unversionedId": "lorem",
"id": "lorem", "id": "lorem",
"title": "lorem", "title": "lorem",
"description": "Lorem ipsum.", "description": "Lorem ipsum.",
@ -742,7 +728,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-root-absolute-slug-md-db5.json": "{ "site-docs-root-absolute-slug-md-db5.json": "{
"unversionedId": "rootAbsoluteSlug",
"id": "rootAbsoluteSlug", "id": "rootAbsoluteSlug",
"title": "rootAbsoluteSlug", "title": "rootAbsoluteSlug",
"description": "Lorem", "description": "Lorem",
@ -770,7 +755,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-root-relative-slug-md-3dd.json": "{ "site-docs-root-relative-slug-md-3dd.json": "{
"unversionedId": "rootRelativeSlug",
"id": "rootRelativeSlug", "id": "rootRelativeSlug",
"title": "rootRelativeSlug", "title": "rootRelativeSlug",
"description": "Lorem", "description": "Lorem",
@ -798,7 +782,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-root-resolved-slug-md-4d1.json": "{ "site-docs-root-resolved-slug-md-4d1.json": "{
"unversionedId": "rootResolvedSlug",
"id": "rootResolvedSlug", "id": "rootResolvedSlug",
"title": "rootResolvedSlug", "title": "rootResolvedSlug",
"description": "Lorem", "description": "Lorem",
@ -826,7 +809,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-root-try-to-escape-slug-md-9ee.json": "{ "site-docs-root-try-to-escape-slug-md-9ee.json": "{
"unversionedId": "rootTryToEscapeSlug",
"id": "rootTryToEscapeSlug", "id": "rootTryToEscapeSlug",
"title": "rootTryToEscapeSlug", "title": "rootTryToEscapeSlug",
"description": "Lorem", "description": "Lorem",
@ -854,7 +836,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-slugs-absolute-slug-md-4e8.json": "{ "site-docs-slugs-absolute-slug-md-4e8.json": "{
"unversionedId": "slugs/absoluteSlug",
"id": "slugs/absoluteSlug", "id": "slugs/absoluteSlug",
"title": "absoluteSlug", "title": "absoluteSlug",
"description": "Lorem", "description": "Lorem",
@ -871,7 +852,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-slugs-relative-slug-md-d1c.json": "{ "site-docs-slugs-relative-slug-md-d1c.json": "{
"unversionedId": "slugs/relativeSlug",
"id": "slugs/relativeSlug", "id": "slugs/relativeSlug",
"title": "relativeSlug", "title": "relativeSlug",
"description": "Lorem", "description": "Lorem",
@ -888,7 +868,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-slugs-resolved-slug-md-02b.json": "{ "site-docs-slugs-resolved-slug-md-02b.json": "{
"unversionedId": "slugs/resolvedSlug",
"id": "slugs/resolvedSlug", "id": "slugs/resolvedSlug",
"title": "resolvedSlug", "title": "resolvedSlug",
"description": "Lorem", "description": "Lorem",
@ -905,7 +884,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-slugs-try-to-escape-slug-md-70d.json": "{ "site-docs-slugs-try-to-escape-slug-md-70d.json": "{
"unversionedId": "slugs/tryToEscapeSlug",
"id": "slugs/tryToEscapeSlug", "id": "slugs/tryToEscapeSlug",
"title": "tryToEscapeSlug", "title": "tryToEscapeSlug",
"description": "Lorem", "description": "Lorem",
@ -922,7 +900,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-unlisted-category-index-md-efa.json": "{ "site-docs-unlisted-category-index-md-efa.json": "{
"unversionedId": "unlisted-category/unlisted-category-index",
"id": "unlisted-category/unlisted-category-index", "id": "unlisted-category/unlisted-category-index",
"title": "unlisted-category-index", "title": "unlisted-category-index",
"description": "This is an unlisted category index", "description": "This is an unlisted category index",
@ -949,7 +926,6 @@ exports[`simple website content: data 1`] = `
} }
}", }",
"site-docs-unlisted-category-unlisted-category-doc-md-bd6.json": "{ "site-docs-unlisted-category-unlisted-category-doc-md-bd6.json": "{
"unversionedId": "unlisted-category/unlisted-category-doc",
"id": "unlisted-category/unlisted-category-doc", "id": "unlisted-category/unlisted-category-doc",
"title": "unlisted-category-doc", "title": "unlisted-category-doc",
"description": "This is an unlisted category doc", "description": "This is an unlisted category doc",
@ -1856,7 +1832,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/3-API/01_Core APIs/0 --- Client API.md", "source": "@site/docs/3-API/01_Core APIs/0 --- Client API.md",
"sourceDirName": "3-API/01_Core APIs", "sourceDirName": "3-API/01_Core APIs",
"title": "Client API", "title": "Client API",
"unversionedId": "API/Core APIs/Client API",
}, },
{ {
"frontMatter": {}, "frontMatter": {},
@ -1865,7 +1840,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/3-API/01_Core APIs/1 --- Server API.md", "source": "@site/docs/3-API/01_Core APIs/1 --- Server API.md",
"sourceDirName": "3-API/01_Core APIs", "sourceDirName": "3-API/01_Core APIs",
"title": "Server API", "title": "Server API",
"unversionedId": "API/Core APIs/Server API",
}, },
{ {
"frontMatter": {}, "frontMatter": {},
@ -1874,7 +1848,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/3-API/02_Extension APIs/0. Plugin API.md", "source": "@site/docs/3-API/02_Extension APIs/0. Plugin API.md",
"sourceDirName": "3-API/02_Extension APIs", "sourceDirName": "3-API/02_Extension APIs",
"title": "Plugin API", "title": "Plugin API",
"unversionedId": "API/Extension APIs/Plugin API",
}, },
{ {
"frontMatter": {}, "frontMatter": {},
@ -1883,7 +1856,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/3-API/02_Extension APIs/1. Theme API.md", "source": "@site/docs/3-API/02_Extension APIs/1. Theme API.md",
"sourceDirName": "3-API/02_Extension APIs", "sourceDirName": "3-API/02_Extension APIs",
"title": "Theme API", "title": "Theme API",
"unversionedId": "API/Extension APIs/Theme API",
}, },
{ {
"frontMatter": {}, "frontMatter": {},
@ -1892,7 +1864,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/3-API/03_api-end.md", "source": "@site/docs/3-API/03_api-end.md",
"sourceDirName": "3-API", "sourceDirName": "3-API",
"title": "API End", "title": "API End",
"unversionedId": "API/api-end",
}, },
{ {
"frontMatter": {}, "frontMatter": {},
@ -1901,7 +1872,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/3-API/00_api-overview.md", "source": "@site/docs/3-API/00_api-overview.md",
"sourceDirName": "3-API", "sourceDirName": "3-API",
"title": "API Overview", "title": "API Overview",
"unversionedId": "API/api-overview",
}, },
{ {
"frontMatter": { "frontMatter": {
@ -1913,7 +1883,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/Guides/z-guide1.md", "source": "@site/docs/Guides/z-guide1.md",
"sourceDirName": "Guides", "sourceDirName": "Guides",
"title": "Guide 1", "title": "Guide 1",
"unversionedId": "Guides/guide1",
}, },
{ {
"frontMatter": { "frontMatter": {
@ -1924,7 +1893,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/Guides/02-guide2.md", "source": "@site/docs/Guides/02-guide2.md",
"sourceDirName": "Guides", "sourceDirName": "Guides",
"title": "Guide 2", "title": "Guide 2",
"unversionedId": "Guides/guide2",
}, },
{ {
"frontMatter": { "frontMatter": {
@ -1936,7 +1904,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/Guides/0-guide2.5.md", "source": "@site/docs/Guides/0-guide2.5.md",
"sourceDirName": "Guides", "sourceDirName": "Guides",
"title": "Guide 2.5", "title": "Guide 2.5",
"unversionedId": "Guides/guide2.5",
}, },
{ {
"frontMatter": { "frontMatter": {
@ -1948,7 +1915,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/Guides/guide3.md", "source": "@site/docs/Guides/guide3.md",
"sourceDirName": "Guides", "sourceDirName": "Guides",
"title": "Guide 3", "title": "Guide 3",
"unversionedId": "Guides/guide3",
}, },
{ {
"frontMatter": { "frontMatter": {
@ -1959,7 +1925,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/Guides/a-guide4.md", "source": "@site/docs/Guides/a-guide4.md",
"sourceDirName": "Guides", "sourceDirName": "Guides",
"title": "Guide 4", "title": "Guide 4",
"unversionedId": "Guides/guide4",
}, },
{ {
"frontMatter": { "frontMatter": {
@ -1970,7 +1935,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/Guides/b-guide5.md", "source": "@site/docs/Guides/b-guide5.md",
"sourceDirName": "Guides", "sourceDirName": "Guides",
"title": "Guide 5", "title": "Guide 5",
"unversionedId": "Guides/guide5",
}, },
{ {
"frontMatter": {}, "frontMatter": {},
@ -1979,7 +1943,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/0-getting-started.md", "source": "@site/docs/0-getting-started.md",
"sourceDirName": ".", "sourceDirName": ".",
"title": "Getting Started", "title": "Getting Started",
"unversionedId": "getting-started",
}, },
{ {
"frontMatter": {}, "frontMatter": {},
@ -1988,7 +1951,6 @@ exports[`site with custom sidebar items generator sidebarItemsGenerator is calle
"source": "@site/docs/1-installation.md", "source": "@site/docs/1-installation.md",
"sourceDirName": ".", "sourceDirName": ".",
"title": "Installation", "title": "Installation",
"unversionedId": "installation",
}, },
], ],
"isCategoryIndex": [Function], "isCategoryIndex": [Function],
@ -2028,7 +1990,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "Getting Started", "title": "Getting Started",
"unlisted": false, "unlisted": false,
"unversionedId": "getting-started",
"version": "current", "version": "current",
} }
`; `;
@ -2060,7 +2021,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "Installation", "title": "Installation",
"unlisted": false, "unlisted": false,
"unversionedId": "installation",
"version": "current", "version": "current",
} }
`; `;
@ -2095,7 +2055,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "Guide 1", "title": "Guide 1",
"unlisted": false, "unlisted": false,
"unversionedId": "Guides/guide1",
"version": "current", "version": "current",
} }
`; `;
@ -2129,7 +2088,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "Guide 2", "title": "Guide 2",
"unlisted": false, "unlisted": false,
"unversionedId": "Guides/guide2",
"version": "current", "version": "current",
} }
`; `;
@ -2164,7 +2122,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "Guide 2.5", "title": "Guide 2.5",
"unlisted": false, "unlisted": false,
"unversionedId": "Guides/guide2.5",
"version": "current", "version": "current",
} }
`; `;
@ -2199,7 +2156,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "Guide 3", "title": "Guide 3",
"unlisted": false, "unlisted": false,
"unversionedId": "Guides/guide3",
"version": "current", "version": "current",
} }
`; `;
@ -2233,7 +2189,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "Guide 4", "title": "Guide 4",
"unlisted": false, "unlisted": false,
"unversionedId": "Guides/guide4",
"version": "current", "version": "current",
} }
`; `;
@ -2267,7 +2222,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "Guide 5", "title": "Guide 5",
"unlisted": false, "unlisted": false,
"unversionedId": "Guides/guide5",
"version": "current", "version": "current",
} }
`; `;
@ -2299,7 +2253,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "API Overview", "title": "API Overview",
"unlisted": false, "unlisted": false,
"unversionedId": "API/api-overview",
"version": "current", "version": "current",
} }
`; `;
@ -2331,7 +2284,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "Client API", "title": "Client API",
"unlisted": false, "unlisted": false,
"unversionedId": "API/Core APIs/Client API",
"version": "current", "version": "current",
} }
`; `;
@ -2363,7 +2315,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "Server API", "title": "Server API",
"unlisted": false, "unlisted": false,
"unversionedId": "API/Core APIs/Server API",
"version": "current", "version": "current",
} }
`; `;
@ -2395,7 +2346,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "Plugin API", "title": "Plugin API",
"unlisted": false, "unlisted": false,
"unversionedId": "API/Extension APIs/Plugin API",
"version": "current", "version": "current",
} }
`; `;
@ -2427,7 +2377,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "Theme API", "title": "Theme API",
"unlisted": false, "unlisted": false,
"unversionedId": "API/Extension APIs/Theme API",
"version": "current", "version": "current",
} }
`; `;
@ -2456,7 +2405,6 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha
"tags": [], "tags": [],
"title": "API End", "title": "API End",
"unlisted": false, "unlisted": false,
"unversionedId": "API/api-end",
"version": "current", "version": "current",
} }
`; `;
@ -2637,7 +2585,6 @@ exports[`site with partial autogenerated sidebars docs in partially generated si
"tags": [], "tags": [],
"title": "API End", "title": "API End",
"unlisted": false, "unlisted": false,
"unversionedId": "API/api-end",
"version": "current", "version": "current",
} }
`; `;
@ -2669,7 +2616,6 @@ exports[`site with partial autogenerated sidebars docs in partially generated si
"tags": [], "tags": [],
"title": "API Overview", "title": "API Overview",
"unlisted": false, "unlisted": false,
"unversionedId": "API/api-overview",
"version": "current", "version": "current",
} }
`; `;
@ -2701,7 +2647,6 @@ exports[`site with partial autogenerated sidebars docs in partially generated si
"tags": [], "tags": [],
"title": "Plugin API", "title": "Plugin API",
"unlisted": false, "unlisted": false,
"unversionedId": "API/Extension APIs/Plugin API",
"version": "current", "version": "current",
} }
`; `;
@ -2730,7 +2675,6 @@ exports[`site with partial autogenerated sidebars docs in partially generated si
"tags": [], "tags": [],
"title": "Theme API", "title": "Theme API",
"unlisted": false, "unlisted": false,
"unversionedId": "API/Extension APIs/Theme API",
"version": "current", "version": "current",
} }
`; `;
@ -2790,7 +2734,6 @@ exports[`versioned website (community) content 1`] = `
"tags": [], "tags": [],
"title": "Team title translated", "title": "Team title translated",
"unlisted": false, "unlisted": false,
"unversionedId": "team",
"version": "current", "version": "current",
} }
`; `;
@ -2802,13 +2745,13 @@ exports[`versioned website (community) content 2`] = `
"editUrl": undefined, "editUrl": undefined,
"formattedLastUpdatedAt": undefined, "formattedLastUpdatedAt": undefined,
"frontMatter": {}, "frontMatter": {},
"id": "version-1.0.0/team", "id": "team",
"lastUpdatedAt": undefined, "lastUpdatedAt": undefined,
"lastUpdatedBy": undefined, "lastUpdatedBy": undefined,
"next": undefined, "next": undefined,
"permalink": "/community/team", "permalink": "/community/team",
"previous": undefined, "previous": undefined,
"sidebar": "version-1.0.0/community", "sidebar": "community",
"sidebarPosition": undefined, "sidebarPosition": undefined,
"slug": "/team", "slug": "/team",
"source": "@site/community_versioned_docs/version-1.0.0/team.md", "source": "@site/community_versioned_docs/version-1.0.0/team.md",
@ -2816,16 +2759,15 @@ exports[`versioned website (community) content 2`] = `
"tags": [], "tags": [],
"title": "team", "title": "team",
"unlisted": false, "unlisted": false,
"unversionedId": "team",
"version": "1.0.0", "version": "1.0.0",
} }
`; `;
exports[`versioned website (community) content: 100 version sidebars 1`] = ` exports[`versioned website (community) content: 100 version sidebars 1`] = `
{ {
"version-1.0.0/community": [ "community": [
{ {
"id": "version-1.0.0/team", "id": "team",
"type": "doc", "type": "doc",
}, },
], ],
@ -2846,8 +2788,7 @@ exports[`versioned website (community) content: current version sidebars 1`] = `
exports[`versioned website (community) content: data 1`] = ` exports[`versioned website (community) content: data 1`] = `
{ {
"site-community-versioned-docs-version-1-0-0-team-md-359.json": "{ "site-community-versioned-docs-version-1-0-0-team-md-359.json": "{
"unversionedId": "team", "id": "team",
"id": "version-1.0.0/team",
"title": "team", "title": "team",
"description": "Team 1.0.0", "description": "Team 1.0.0",
"source": "@site/community_versioned_docs/version-1.0.0/team.md", "source": "@site/community_versioned_docs/version-1.0.0/team.md",
@ -2859,10 +2800,9 @@ exports[`versioned website (community) content: data 1`] = `
"tags": [], "tags": [],
"version": "1.0.0", "version": "1.0.0",
"frontMatter": {}, "frontMatter": {},
"sidebar": "version-1.0.0/community" "sidebar": "community"
}", }",
"site-i-18-n-en-docusaurus-plugin-content-docs-community-current-team-md-7e5.json": "{ "site-i-18-n-en-docusaurus-plugin-content-docs-community-current-team-md-7e5.json": "{
"unversionedId": "team",
"id": "team", "id": "team",
"title": "Team title translated", "title": "Team title translated",
"description": "Team current version (translated)", "description": "Team current version (translated)",
@ -2889,7 +2829,7 @@ exports[`versioned website (community) content: data 1`] = `
"className": "docs-version-1.0.0", "className": "docs-version-1.0.0",
"isLast": true, "isLast": true,
"docsSidebars": { "docsSidebars": {
"version-1.0.0/community": [ "community": [
{ {
"type": "link", "type": "link",
"label": "team", "label": "team",
@ -2904,7 +2844,7 @@ exports[`versioned website (community) content: data 1`] = `
"id": "team", "id": "team",
"title": "team", "title": "team",
"description": "Team 1.0.0", "description": "Team 1.0.0",
"sidebar": "version-1.0.0/community" "sidebar": "community"
} }
} }
}", }",
@ -2975,7 +2915,7 @@ exports[`versioned website (community) content: global data 1`] = `
{ {
"id": "team", "id": "team",
"path": "/community/team", "path": "/community/team",
"sidebar": "version-1.0.0/community", "sidebar": "community",
}, },
], ],
"draftIds": [], "draftIds": [],
@ -2985,9 +2925,9 @@ exports[`versioned website (community) content: global data 1`] = `
"name": "1.0.0", "name": "1.0.0",
"path": "/community", "path": "/community",
"sidebars": { "sidebars": {
"version-1.0.0/community": { "community": {
"link": { "link": {
"label": "version-1.0.0/team", "label": "team",
"path": "/community/team", "path": "/community/team",
}, },
}, },
@ -3054,7 +2994,7 @@ exports[`versioned website (community) content: route config 1`] = `
"content": "@site/community_versioned_docs/version-1.0.0/team.md", "content": "@site/community_versioned_docs/version-1.0.0/team.md",
}, },
"path": "/community/team", "path": "/community/team",
"sidebar": "version-1.0.0/community", "sidebar": "community",
}, },
], ],
}, },
@ -3125,7 +3065,6 @@ exports[`versioned website content 1`] = `
], ],
"title": "bar", "title": "bar",
"unlisted": false, "unlisted": false,
"unversionedId": "foo/bar",
"version": "current", "version": "current",
} }
`; `;
@ -3137,7 +3076,7 @@ exports[`versioned website content 2`] = `
"editUrl": undefined, "editUrl": undefined,
"formattedLastUpdatedAt": undefined, "formattedLastUpdatedAt": undefined,
"frontMatter": {}, "frontMatter": {},
"id": "version-1.0.1/foo/bar", "id": "foo/bar",
"lastUpdatedAt": undefined, "lastUpdatedAt": undefined,
"lastUpdatedBy": undefined, "lastUpdatedBy": undefined,
"next": { "next": {
@ -3154,7 +3093,6 @@ exports[`versioned website content 2`] = `
"tags": [], "tags": [],
"title": "bar", "title": "bar",
"unlisted": false, "unlisted": false,
"unversionedId": "foo/bar",
"version": "1.0.1", "version": "1.0.1",
} }
`; `;
@ -3185,7 +3123,6 @@ exports[`versioned website content 3`] = `
"tags": [], "tags": [],
"title": "hello", "title": "hello",
"unlisted": false, "unlisted": false,
"unversionedId": "hello",
"version": "current", "version": "current",
} }
`; `;
@ -3199,7 +3136,7 @@ exports[`versioned website content 4`] = `
"frontMatter": { "frontMatter": {
"slug": "/", "slug": "/",
}, },
"id": "version-1.0.1/hello", "id": "hello",
"lastUpdatedAt": undefined, "lastUpdatedAt": undefined,
"lastUpdatedBy": undefined, "lastUpdatedBy": undefined,
"next": undefined, "next": undefined,
@ -3216,7 +3153,6 @@ exports[`versioned website content 4`] = `
"tags": [], "tags": [],
"title": "hello", "title": "hello",
"unlisted": false, "unlisted": false,
"unversionedId": "hello",
"version": "1.0.1", "version": "1.0.1",
} }
`; `;
@ -3228,7 +3164,7 @@ exports[`versioned website content 5`] = `
"editUrl": undefined, "editUrl": undefined,
"formattedLastUpdatedAt": undefined, "formattedLastUpdatedAt": undefined,
"frontMatter": {}, "frontMatter": {},
"id": "version-1.0.0/foo/baz", "id": "foo/baz",
"lastUpdatedAt": undefined, "lastUpdatedAt": undefined,
"lastUpdatedBy": undefined, "lastUpdatedBy": undefined,
"next": { "next": {
@ -3240,7 +3176,7 @@ exports[`versioned website content 5`] = `
"permalink": "/docs/1.0.0/foo/barSlug", "permalink": "/docs/1.0.0/foo/barSlug",
"title": "bar", "title": "bar",
}, },
"sidebar": "version-1.0.0/docs", "sidebar": "docs",
"sidebarPosition": undefined, "sidebarPosition": undefined,
"slug": "/foo/baz", "slug": "/foo/baz",
"source": "@site/versioned_docs/version-1.0.0/foo/baz.md", "source": "@site/versioned_docs/version-1.0.0/foo/baz.md",
@ -3248,24 +3184,23 @@ exports[`versioned website content 5`] = `
"tags": [], "tags": [],
"title": "baz", "title": "baz",
"unlisted": false, "unlisted": false,
"unversionedId": "foo/baz",
"version": "1.0.0", "version": "1.0.0",
} }
`; `;
exports[`versioned website content: 100 version sidebars 1`] = ` exports[`versioned website content: 100 version sidebars 1`] = `
{ {
"version-1.0.0/docs": [ "docs": [
{ {
"collapsed": true, "collapsed": true,
"collapsible": true, "collapsible": true,
"items": [ "items": [
{ {
"id": "version-1.0.0/foo/bar", "id": "foo/bar",
"type": "doc", "type": "doc",
}, },
{ {
"id": "version-1.0.0/foo/baz", "id": "foo/baz",
"type": "doc", "type": "doc",
}, },
], ],
@ -3278,7 +3213,7 @@ exports[`versioned website content: 100 version sidebars 1`] = `
"collapsible": true, "collapsible": true,
"items": [ "items": [
{ {
"id": "version-1.0.0/hello", "id": "hello",
"type": "doc", "type": "doc",
}, },
], ],
@ -3311,7 +3246,7 @@ exports[`versioned website content: 101 version sidebars 1`] = `
"collapsible": true, "collapsible": true,
"items": [ "items": [
{ {
"id": "version-1.0.1/hello", "id": "hello",
"type": "doc", "type": "doc",
}, },
], ],
@ -3359,7 +3294,6 @@ exports[`versioned website content: current version sidebars 1`] = `
exports[`versioned website content: data 1`] = ` exports[`versioned website content: data 1`] = `
{ {
"site-docs-foo-bar-md-8c2.json": "{ "site-docs-foo-bar-md-8c2.json": "{
"unversionedId": "foo/bar",
"id": "foo/bar", "id": "foo/bar",
"title": "bar", "title": "bar",
"description": "This is next version of bar.", "description": "This is next version of bar.",
@ -3402,7 +3336,6 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-docs-hello-md-9df.json": "{ "site-docs-hello-md-9df.json": "{
"unversionedId": "hello",
"id": "hello", "id": "hello",
"title": "hello", "title": "hello",
"description": "Hello next !", "description": "Hello next !",
@ -3424,7 +3357,6 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-docs-slugs-absolute-slug-md-4e8.json": "{ "site-docs-slugs-absolute-slug-md-4e8.json": "{
"unversionedId": "slugs/absoluteSlug",
"id": "slugs/absoluteSlug", "id": "slugs/absoluteSlug",
"title": "absoluteSlug", "title": "absoluteSlug",
"description": "Lorem", "description": "Lorem",
@ -3441,7 +3373,6 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-docs-slugs-relative-slug-md-d1c.json": "{ "site-docs-slugs-relative-slug-md-d1c.json": "{
"unversionedId": "slugs/relativeSlug",
"id": "slugs/relativeSlug", "id": "slugs/relativeSlug",
"title": "relativeSlug", "title": "relativeSlug",
"description": "Lorem", "description": "Lorem",
@ -3458,7 +3389,6 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-docs-slugs-resolved-slug-md-02b.json": "{ "site-docs-slugs-resolved-slug-md-02b.json": "{
"unversionedId": "slugs/resolvedSlug",
"id": "slugs/resolvedSlug", "id": "slugs/resolvedSlug",
"title": "resolvedSlug", "title": "resolvedSlug",
"description": "Lorem", "description": "Lorem",
@ -3475,7 +3405,6 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-docs-slugs-try-to-escape-slug-md-70d.json": "{ "site-docs-slugs-try-to-escape-slug-md-70d.json": "{
"unversionedId": "slugs/tryToEscapeSlug",
"id": "slugs/tryToEscapeSlug", "id": "slugs/tryToEscapeSlug",
"title": "tryToEscapeSlug", "title": "tryToEscapeSlug",
"description": "Lorem", "description": "Lorem",
@ -3492,8 +3421,7 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-i-18-n-en-docusaurus-plugin-content-docs-version-1-0-0-hello-md-fe5.json": "{ "site-i-18-n-en-docusaurus-plugin-content-docs-version-1-0-0-hello-md-fe5.json": "{
"unversionedId": "hello", "id": "hello",
"id": "version-1.0.0/hello",
"title": "hello", "title": "hello",
"description": "Hello 1.0.0 ! (translated en)", "description": "Hello 1.0.0 ! (translated en)",
"source": "@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md", "source": "@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md",
@ -3507,15 +3435,14 @@ exports[`versioned website content: data 1`] = `
"frontMatter": { "frontMatter": {
"slug": "/" "slug": "/"
}, },
"sidebar": "version-1.0.0/docs", "sidebar": "docs",
"previous": { "previous": {
"title": "baz", "title": "baz",
"permalink": "/docs/1.0.0/foo/baz" "permalink": "/docs/1.0.0/foo/baz"
} }
}", }",
"site-versioned-docs-version-1-0-0-foo-bar-md-7a6.json": "{ "site-versioned-docs-version-1-0-0-foo-bar-md-7a6.json": "{
"unversionedId": "foo/bar", "id": "foo/bar",
"id": "version-1.0.0/foo/bar",
"title": "bar", "title": "bar",
"description": "Bar 1.0.0 !", "description": "Bar 1.0.0 !",
"source": "@site/versioned_docs/version-1.0.0/foo/bar.md", "source": "@site/versioned_docs/version-1.0.0/foo/bar.md",
@ -3529,15 +3456,14 @@ exports[`versioned website content: data 1`] = `
"frontMatter": { "frontMatter": {
"slug": "barSlug" "slug": "barSlug"
}, },
"sidebar": "version-1.0.0/docs", "sidebar": "docs",
"next": { "next": {
"title": "baz", "title": "baz",
"permalink": "/docs/1.0.0/foo/baz" "permalink": "/docs/1.0.0/foo/baz"
} }
}", }",
"site-versioned-docs-version-1-0-0-foo-baz-md-883.json": "{ "site-versioned-docs-version-1-0-0-foo-baz-md-883.json": "{
"unversionedId": "foo/baz", "id": "foo/baz",
"id": "version-1.0.0/foo/baz",
"title": "baz", "title": "baz",
"description": "Baz 1.0.0 ! This will be deleted in next subsequent versions.", "description": "Baz 1.0.0 ! This will be deleted in next subsequent versions.",
"source": "@site/versioned_docs/version-1.0.0/foo/baz.md", "source": "@site/versioned_docs/version-1.0.0/foo/baz.md",
@ -3549,7 +3475,7 @@ exports[`versioned website content: data 1`] = `
"tags": [], "tags": [],
"version": "1.0.0", "version": "1.0.0",
"frontMatter": {}, "frontMatter": {},
"sidebar": "version-1.0.0/docs", "sidebar": "docs",
"previous": { "previous": {
"title": "bar", "title": "bar",
"permalink": "/docs/1.0.0/foo/barSlug" "permalink": "/docs/1.0.0/foo/barSlug"
@ -3560,8 +3486,7 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-versioned-docs-version-1-0-1-foo-bar-md-7a3.json": "{ "site-versioned-docs-version-1-0-1-foo-bar-md-7a3.json": "{
"unversionedId": "foo/bar", "id": "foo/bar",
"id": "version-1.0.1/foo/bar",
"title": "bar", "title": "bar",
"description": "Bar 1.0.1 !", "description": "Bar 1.0.1 !",
"source": "@site/versioned_docs/version-1.0.1/foo/bar.md", "source": "@site/versioned_docs/version-1.0.1/foo/bar.md",
@ -3580,8 +3505,7 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-versioned-docs-version-1-0-1-hello-md-0c7.json": "{ "site-versioned-docs-version-1-0-1-hello-md-0c7.json": "{
"unversionedId": "hello", "id": "hello",
"id": "version-1.0.1/hello",
"title": "hello", "title": "hello",
"description": "Hello 1.0.1 !", "description": "Hello 1.0.1 !",
"source": "@site/versioned_docs/version-1.0.1/hello.md", "source": "@site/versioned_docs/version-1.0.1/hello.md",
@ -3602,8 +3526,7 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-versioned-docs-version-with-slugs-root-absolute-slug-md-4d2.json": "{ "site-versioned-docs-version-with-slugs-root-absolute-slug-md-4d2.json": "{
"unversionedId": "rootAbsoluteSlug", "id": "rootAbsoluteSlug",
"id": "version-withSlugs/rootAbsoluteSlug",
"title": "rootAbsoluteSlug", "title": "rootAbsoluteSlug",
"description": "Lorem", "description": "Lorem",
"source": "@site/versioned_docs/version-withSlugs/rootAbsoluteSlug.md", "source": "@site/versioned_docs/version-withSlugs/rootAbsoluteSlug.md",
@ -3617,11 +3540,10 @@ exports[`versioned website content: data 1`] = `
"frontMatter": { "frontMatter": {
"slug": "/rootAbsoluteSlug" "slug": "/rootAbsoluteSlug"
}, },
"sidebar": "version-1.0.1/docs" "sidebar": "docs"
}", }",
"site-versioned-docs-version-with-slugs-root-relative-slug-md-32a.json": "{ "site-versioned-docs-version-with-slugs-root-relative-slug-md-32a.json": "{
"unversionedId": "rootRelativeSlug", "id": "rootRelativeSlug",
"id": "version-withSlugs/rootRelativeSlug",
"title": "rootRelativeSlug", "title": "rootRelativeSlug",
"description": "Lorem", "description": "Lorem",
"source": "@site/versioned_docs/version-withSlugs/rootRelativeSlug.md", "source": "@site/versioned_docs/version-withSlugs/rootRelativeSlug.md",
@ -3637,8 +3559,7 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-versioned-docs-version-with-slugs-root-resolved-slug-md-aee.json": "{ "site-versioned-docs-version-with-slugs-root-resolved-slug-md-aee.json": "{
"unversionedId": "rootResolvedSlug", "id": "rootResolvedSlug",
"id": "version-withSlugs/rootResolvedSlug",
"title": "rootResolvedSlug", "title": "rootResolvedSlug",
"description": "Lorem", "description": "Lorem",
"source": "@site/versioned_docs/version-withSlugs/rootResolvedSlug.md", "source": "@site/versioned_docs/version-withSlugs/rootResolvedSlug.md",
@ -3654,8 +3575,7 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-versioned-docs-version-with-slugs-root-try-to-escape-slug-md-b5d.json": "{ "site-versioned-docs-version-with-slugs-root-try-to-escape-slug-md-b5d.json": "{
"unversionedId": "rootTryToEscapeSlug", "id": "rootTryToEscapeSlug",
"id": "version-withSlugs/rootTryToEscapeSlug",
"title": "rootTryToEscapeSlug", "title": "rootTryToEscapeSlug",
"description": "Lorem", "description": "Lorem",
"source": "@site/versioned_docs/version-withSlugs/rootTryToEscapeSlug.md", "source": "@site/versioned_docs/version-withSlugs/rootTryToEscapeSlug.md",
@ -3671,8 +3591,7 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-versioned-docs-version-with-slugs-slugs-absolute-slug-md-47a.json": "{ "site-versioned-docs-version-with-slugs-slugs-absolute-slug-md-47a.json": "{
"unversionedId": "slugs/absoluteSlug", "id": "slugs/absoluteSlug",
"id": "version-withSlugs/slugs/absoluteSlug",
"title": "absoluteSlug", "title": "absoluteSlug",
"description": "Lorem", "description": "Lorem",
"source": "@site/versioned_docs/version-withSlugs/slugs/absoluteSlug.md", "source": "@site/versioned_docs/version-withSlugs/slugs/absoluteSlug.md",
@ -3688,8 +3607,7 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-versioned-docs-version-with-slugs-slugs-relative-slug-md-a95.json": "{ "site-versioned-docs-version-with-slugs-slugs-relative-slug-md-a95.json": "{
"unversionedId": "slugs/relativeSlug", "id": "slugs/relativeSlug",
"id": "version-withSlugs/slugs/relativeSlug",
"title": "relativeSlug", "title": "relativeSlug",
"description": "Lorem", "description": "Lorem",
"source": "@site/versioned_docs/version-withSlugs/slugs/relativeSlug.md", "source": "@site/versioned_docs/version-withSlugs/slugs/relativeSlug.md",
@ -3705,8 +3623,7 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-versioned-docs-version-with-slugs-slugs-resolved-slug-md-5a1.json": "{ "site-versioned-docs-version-with-slugs-slugs-resolved-slug-md-5a1.json": "{
"unversionedId": "slugs/resolvedSlug", "id": "slugs/resolvedSlug",
"id": "version-withSlugs/slugs/resolvedSlug",
"title": "resolvedSlug", "title": "resolvedSlug",
"description": "Lorem", "description": "Lorem",
"source": "@site/versioned_docs/version-withSlugs/slugs/resolvedSlug.md", "source": "@site/versioned_docs/version-withSlugs/slugs/resolvedSlug.md",
@ -3722,8 +3639,7 @@ exports[`versioned website content: data 1`] = `
} }
}", }",
"site-versioned-docs-version-with-slugs-slugs-try-to-escape-slug-md-4e1.json": "{ "site-versioned-docs-version-with-slugs-slugs-try-to-escape-slug-md-4e1.json": "{
"unversionedId": "slugs/tryToEscapeSlug", "id": "slugs/tryToEscapeSlug",
"id": "version-withSlugs/slugs/tryToEscapeSlug",
"title": "tryToEscapeSlug", "title": "tryToEscapeSlug",
"description": "Lorem", "description": "Lorem",
"source": "@site/versioned_docs/version-withSlugs/slugs/tryToEscapeSlug.md", "source": "@site/versioned_docs/version-withSlugs/slugs/tryToEscapeSlug.md",
@ -3810,7 +3726,7 @@ exports[`versioned website content: data 1`] = `
"className": "docs-version-1.0.0", "className": "docs-version-1.0.0",
"isLast": false, "isLast": false,
"docsSidebars": { "docsSidebars": {
"version-1.0.0/docs": [ "docs": [
{ {
"type": "category", "type": "category",
"label": "Test", "label": "Test",
@ -3855,19 +3771,19 @@ exports[`versioned website content: data 1`] = `
"id": "foo/bar", "id": "foo/bar",
"title": "bar", "title": "bar",
"description": "Bar 1.0.0 !", "description": "Bar 1.0.0 !",
"sidebar": "version-1.0.0/docs" "sidebar": "docs"
}, },
"foo/baz": { "foo/baz": {
"id": "foo/baz", "id": "foo/baz",
"title": "baz", "title": "baz",
"description": "Baz 1.0.0 ! This will be deleted in next subsequent versions.", "description": "Baz 1.0.0 ! This will be deleted in next subsequent versions.",
"sidebar": "version-1.0.0/docs" "sidebar": "docs"
}, },
"hello": { "hello": {
"id": "hello", "id": "hello",
"title": "hello", "title": "hello",
"description": "Hello 1.0.0 ! (translated en)", "description": "Hello 1.0.0 ! (translated en)",
"sidebar": "version-1.0.0/docs" "sidebar": "docs"
} }
} }
}", }",
@ -4017,7 +3933,7 @@ exports[`versioned website content: data 1`] = `
"className": "docs-version-withSlugs", "className": "docs-version-withSlugs",
"isLast": false, "isLast": false,
"docsSidebars": { "docsSidebars": {
"version-1.0.1/docs": [ "docs": [
{ {
"type": "category", "type": "category",
"label": "Test", "label": "Test",
@ -4040,7 +3956,7 @@ exports[`versioned website content: data 1`] = `
"id": "rootAbsoluteSlug", "id": "rootAbsoluteSlug",
"title": "rootAbsoluteSlug", "title": "rootAbsoluteSlug",
"description": "Lorem", "description": "Lorem",
"sidebar": "version-1.0.1/docs" "sidebar": "docs"
}, },
"rootRelativeSlug": { "rootRelativeSlug": {
"id": "rootRelativeSlug", "id": "rootRelativeSlug",
@ -4170,17 +4086,17 @@ exports[`versioned website content: global data 1`] = `
{ {
"id": "foo/bar", "id": "foo/bar",
"path": "/docs/1.0.0/foo/barSlug", "path": "/docs/1.0.0/foo/barSlug",
"sidebar": "version-1.0.0/docs", "sidebar": "docs",
}, },
{ {
"id": "foo/baz", "id": "foo/baz",
"path": "/docs/1.0.0/foo/baz", "path": "/docs/1.0.0/foo/baz",
"sidebar": "version-1.0.0/docs", "sidebar": "docs",
}, },
{ {
"id": "hello", "id": "hello",
"path": "/docs/1.0.0/", "path": "/docs/1.0.0/",
"sidebar": "version-1.0.0/docs", "sidebar": "docs",
}, },
], ],
"draftIds": [], "draftIds": [],
@ -4190,9 +4106,9 @@ exports[`versioned website content: global data 1`] = `
"name": "1.0.0", "name": "1.0.0",
"path": "/docs/1.0.0", "path": "/docs/1.0.0",
"sidebars": { "sidebars": {
"version-1.0.0/docs": { "docs": {
"link": { "link": {
"label": "version-1.0.0/foo/bar", "label": "foo/bar",
"path": "/docs/1.0.0/foo/barSlug", "path": "/docs/1.0.0/foo/barSlug",
}, },
}, },
@ -4203,7 +4119,7 @@ exports[`versioned website content: global data 1`] = `
{ {
"id": "rootAbsoluteSlug", "id": "rootAbsoluteSlug",
"path": "/docs/withSlugs/rootAbsoluteSlug", "path": "/docs/withSlugs/rootAbsoluteSlug",
"sidebar": "version-1.0.1/docs", "sidebar": "docs",
}, },
{ {
"id": "rootRelativeSlug", "id": "rootRelativeSlug",
@ -4248,9 +4164,9 @@ exports[`versioned website content: global data 1`] = `
"name": "withSlugs", "name": "withSlugs",
"path": "/docs/withSlugs", "path": "/docs/withSlugs",
"sidebars": { "sidebars": {
"version-1.0.1/docs": { "docs": {
"link": { "link": {
"label": "version-withSlugs/rootAbsoluteSlug", "label": "rootAbsoluteSlug",
"path": "/docs/withSlugs/rootAbsoluteSlug", "path": "/docs/withSlugs/rootAbsoluteSlug",
}, },
}, },
@ -4290,7 +4206,7 @@ exports[`versioned website content: route config 1`] = `
"content": "@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md", "content": "@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md",
}, },
"path": "/docs/1.0.0/", "path": "/docs/1.0.0/",
"sidebar": "version-1.0.0/docs", "sidebar": "docs",
}, },
{ {
"component": "@theme/DocItem", "component": "@theme/DocItem",
@ -4299,7 +4215,7 @@ exports[`versioned website content: route config 1`] = `
"content": "@site/versioned_docs/version-1.0.0/foo/bar.md", "content": "@site/versioned_docs/version-1.0.0/foo/bar.md",
}, },
"path": "/docs/1.0.0/foo/barSlug", "path": "/docs/1.0.0/foo/barSlug",
"sidebar": "version-1.0.0/docs", "sidebar": "docs",
}, },
{ {
"component": "@theme/DocItem", "component": "@theme/DocItem",
@ -4308,7 +4224,7 @@ exports[`versioned website content: route config 1`] = `
"content": "@site/versioned_docs/version-1.0.0/foo/baz.md", "content": "@site/versioned_docs/version-1.0.0/foo/baz.md",
}, },
"path": "/docs/1.0.0/foo/baz", "path": "/docs/1.0.0/foo/baz",
"sidebar": "version-1.0.0/docs", "sidebar": "docs",
}, },
], ],
}, },
@ -4451,7 +4367,7 @@ exports[`versioned website content: route config 1`] = `
"content": "@site/versioned_docs/version-withSlugs/rootAbsoluteSlug.md", "content": "@site/versioned_docs/version-withSlugs/rootAbsoluteSlug.md",
}, },
"path": "/docs/withSlugs/rootAbsoluteSlug", "path": "/docs/withSlugs/rootAbsoluteSlug",
"sidebar": "version-1.0.1/docs", "sidebar": "docs",
}, },
{ {
"component": "@theme/DocItem", "component": "@theme/DocItem",
@ -4540,13 +4456,13 @@ exports[`versioned website content: route config 1`] = `
exports[`versioned website content: withSlugs version sidebars 1`] = ` exports[`versioned website content: withSlugs version sidebars 1`] = `
{ {
"version-1.0.1/docs": [ "docs": [
{ {
"collapsed": true, "collapsed": true,
"collapsible": true, "collapsible": true,
"items": [ "items": [
{ {
"id": "version-withSlugs/rootAbsoluteSlug", "id": "rootAbsoluteSlug",
"type": "doc", "type": "doc",
}, },
], ],

View file

@ -132,7 +132,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc1 title", "title": "doc1 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
{ {
@ -153,7 +152,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc2 title", "title": "doc2 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
{ {
@ -174,7 +172,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc3 title", "title": "doc3 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
{ {
@ -195,7 +192,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc4 title", "title": "doc4 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
{ {
@ -216,7 +212,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc5 title", "title": "doc5 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
], ],
@ -308,7 +303,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc1 title", "title": "doc1 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
{ {
@ -329,7 +323,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc2 title", "title": "doc2 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
{ {
@ -350,7 +343,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc3 title", "title": "doc3 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
{ {
@ -371,7 +363,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc4 title", "title": "doc4 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
{ {
@ -392,7 +383,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc5 title", "title": "doc5 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
], ],
@ -484,7 +474,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc1 title", "title": "doc1 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
{ {
@ -505,7 +494,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc2 title", "title": "doc2 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
{ {
@ -526,7 +514,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc3 title", "title": "doc3 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
{ {
@ -547,7 +534,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc4 title", "title": "doc4 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
{ {
@ -568,7 +554,6 @@ exports[`translateLoadedContent returns translated loaded content 1`] = `
"sourceDirName": "", "sourceDirName": "",
"tags": [], "tags": [],
"title": "doc5 title", "title": "doc5 title",
"unversionedId": "any",
"version": "any", "version": "any",
}, },
], ],

View file

@ -268,7 +268,6 @@ describe('simple site', () => {
await defaultTestUtils.testMeta(path.join('foo', 'bar.md'), { await defaultTestUtils.testMeta(path.join('foo', 'bar.md'), {
version: 'current', version: 'current',
id: 'foo/bar', id: 'foo/bar',
unversionedId: 'foo/bar',
sourceDirName: 'foo', sourceDirName: 'foo',
permalink: '/docs/foo/bar', permalink: '/docs/foo/bar',
slug: '/foo/bar', slug: '/foo/bar',
@ -287,7 +286,6 @@ describe('simple site', () => {
await defaultTestUtils.testMeta(path.join('hello.md'), { await defaultTestUtils.testMeta(path.join('hello.md'), {
version: 'current', version: 'current',
id: 'hello', id: 'hello',
unversionedId: 'hello',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/', permalink: '/docs/',
slug: '/', slug: '/',
@ -332,7 +330,6 @@ describe('simple site', () => {
await testUtilsLocal.testMeta(path.join('foo', 'baz.md'), { await testUtilsLocal.testMeta(path.join('foo', 'baz.md'), {
version: 'current', version: 'current',
id: 'foo/baz', id: 'foo/baz',
unversionedId: 'foo/baz',
sourceDirName: 'foo', sourceDirName: 'foo',
permalink: '/docs/foo/bazSlug.html', permalink: '/docs/foo/bazSlug.html',
slug: '/foo/bazSlug.html', slug: '/foo/bazSlug.html',
@ -371,7 +368,6 @@ describe('simple site', () => {
await defaultTestUtils.testMeta('lorem.md', { await defaultTestUtils.testMeta('lorem.md', {
version: 'current', version: 'current',
id: 'lorem', id: 'lorem',
unversionedId: 'lorem',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/lorem', permalink: '/docs/lorem',
slug: '/lorem', slug: '/lorem',
@ -409,7 +405,6 @@ describe('simple site', () => {
await testUtilsLocal.testMeta(path.join('foo', 'baz.md'), { await testUtilsLocal.testMeta(path.join('foo', 'baz.md'), {
version: 'current', version: 'current',
id: 'foo/baz', id: 'foo/baz',
unversionedId: 'foo/baz',
sourceDirName: 'foo', sourceDirName: 'foo',
permalink: '/docs/foo/bazSlug.html', permalink: '/docs/foo/bazSlug.html',
slug: '/foo/bazSlug.html', slug: '/foo/bazSlug.html',
@ -469,7 +464,6 @@ describe('simple site', () => {
await testUtilsLocal.testMeta('lorem.md', { await testUtilsLocal.testMeta('lorem.md', {
version: 'current', version: 'current',
id: 'lorem', id: 'lorem',
unversionedId: 'lorem',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/lorem', permalink: '/docs/lorem',
slug: '/lorem', slug: '/lorem',
@ -516,7 +510,6 @@ describe('simple site', () => {
const baseMeta = { const baseMeta = {
version: 'current', version: 'current',
id: 'doc-unlisted', id: 'doc-unlisted',
unversionedId: 'doc-unlisted',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/doc-unlisted', permalink: '/docs/doc-unlisted',
slug: '/doc-unlisted', slug: '/doc-unlisted',
@ -567,7 +560,6 @@ describe('simple site', () => {
await testUtilsLocal.testMeta('customLastUpdate.md', { await testUtilsLocal.testMeta('customLastUpdate.md', {
version: 'current', version: 'current',
id: 'customLastUpdate', id: 'customLastUpdate',
unversionedId: 'customLastUpdate',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/customLastUpdate', permalink: '/docs/customLastUpdate',
slug: '/customLastUpdate', slug: '/customLastUpdate',
@ -608,7 +600,6 @@ describe('simple site', () => {
await testUtilsLocal.testMeta('lastUpdateAuthorOnly.md', { await testUtilsLocal.testMeta('lastUpdateAuthorOnly.md', {
version: 'current', version: 'current',
id: 'lastUpdateAuthorOnly', id: 'lastUpdateAuthorOnly',
unversionedId: 'lastUpdateAuthorOnly',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/lastUpdateAuthorOnly', permalink: '/docs/lastUpdateAuthorOnly',
slug: '/lastUpdateAuthorOnly', slug: '/lastUpdateAuthorOnly',
@ -648,7 +639,6 @@ describe('simple site', () => {
await testUtilsLocal.testMeta('lastUpdateDateOnly.md', { await testUtilsLocal.testMeta('lastUpdateDateOnly.md', {
version: 'current', version: 'current',
id: 'lastUpdateDateOnly', id: 'lastUpdateDateOnly',
unversionedId: 'lastUpdateDateOnly',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/lastUpdateDateOnly', permalink: '/docs/lastUpdateDateOnly',
slug: '/lastUpdateDateOnly', slug: '/lastUpdateDateOnly',
@ -688,7 +678,6 @@ describe('simple site', () => {
await testUtilsLocal.testMeta('customLastUpdate.md', { await testUtilsLocal.testMeta('customLastUpdate.md', {
version: 'current', version: 'current',
id: 'customLastUpdate', id: 'customLastUpdate',
unversionedId: 'customLastUpdate',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/customLastUpdate', permalink: '/docs/customLastUpdate',
slug: '/customLastUpdate', slug: '/customLastUpdate',
@ -875,7 +864,6 @@ describe('versioned site', () => {
await currentVersionTestUtils.testMeta(path.join('foo', 'bar.md'), { await currentVersionTestUtils.testMeta(path.join('foo', 'bar.md'), {
id: 'foo/bar', id: 'foo/bar',
version: 'current', version: 'current',
unversionedId: 'foo/bar',
sourceDirName: 'foo', sourceDirName: 'foo',
permalink: '/docs/next/foo/barSlug', permalink: '/docs/next/foo/barSlug',
slug: '/foo/barSlug', slug: '/foo/barSlug',
@ -911,7 +899,6 @@ describe('versioned site', () => {
await currentVersionTestUtils.testMeta(path.join('hello.md'), { await currentVersionTestUtils.testMeta(path.join('hello.md'), {
id: 'hello', id: 'hello',
version: 'current', version: 'current',
unversionedId: 'hello',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/next/', permalink: '/docs/next/',
slug: '/', slug: '/',
@ -929,8 +916,7 @@ describe('versioned site', () => {
const {version101TestUtils, version100TestUtils} = await loadSite(); const {version101TestUtils, version100TestUtils} = await loadSite();
await version100TestUtils.testMeta(path.join('foo', 'bar.md'), { await version100TestUtils.testMeta(path.join('foo', 'bar.md'), {
id: 'version-1.0.0/foo/bar', id: 'foo/bar',
unversionedId: 'foo/bar',
sourceDirName: 'foo', sourceDirName: 'foo',
permalink: '/docs/1.0.0/foo/barSlug', permalink: '/docs/1.0.0/foo/barSlug',
slug: '/foo/barSlug', slug: '/foo/barSlug',
@ -942,8 +928,7 @@ describe('versioned site', () => {
unlisted: false, unlisted: false,
}); });
await version100TestUtils.testMeta(path.join('hello.md'), { await version100TestUtils.testMeta(path.join('hello.md'), {
id: 'version-1.0.0/hello', id: 'hello',
unversionedId: 'hello',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/1.0.0/', permalink: '/docs/1.0.0/',
slug: '/', slug: '/',
@ -959,8 +944,7 @@ describe('versioned site', () => {
unlisted: false, unlisted: false,
}); });
await version101TestUtils.testMeta(path.join('foo', 'bar.md'), { await version101TestUtils.testMeta(path.join('foo', 'bar.md'), {
id: 'version-1.0.1/foo/bar', id: 'foo/bar',
unversionedId: 'foo/bar',
sourceDirName: 'foo', sourceDirName: 'foo',
permalink: '/docs/foo/bar', permalink: '/docs/foo/bar',
slug: '/foo/bar', slug: '/foo/bar',
@ -972,8 +956,7 @@ describe('versioned site', () => {
unlisted: false, unlisted: false,
}); });
await version101TestUtils.testMeta(path.join('hello.md'), { await version101TestUtils.testMeta(path.join('hello.md'), {
id: 'version-1.0.1/hello', id: 'hello',
unversionedId: 'hello',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/', permalink: '/docs/',
slug: '/', slug: '/',
@ -1066,8 +1049,7 @@ describe('versioned site', () => {
}); });
await testUtilsLocal.testMeta(path.join('hello.md'), { await testUtilsLocal.testMeta(path.join('hello.md'), {
id: 'version-1.0.0/hello', id: 'hello',
unversionedId: 'hello',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/1.0.0/', permalink: '/docs/1.0.0/',
slug: '/', slug: '/',
@ -1109,8 +1091,7 @@ describe('versioned site', () => {
}); });
await testUtilsLocal.testMeta(path.join('hello.md'), { await testUtilsLocal.testMeta(path.join('hello.md'), {
id: 'version-1.0.0/hello', id: 'hello',
unversionedId: 'hello',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/1.0.0/', permalink: '/docs/1.0.0/',
slug: '/', slug: '/',
@ -1145,8 +1126,7 @@ describe('versioned site', () => {
}); });
await testUtilsLocal.testMeta(path.join('hello.md'), { await testUtilsLocal.testMeta(path.join('hello.md'), {
id: 'version-1.0.0/hello', id: 'hello',
unversionedId: 'hello',
sourceDirName: '.', sourceDirName: '.',
permalink: '/docs/1.0.0/', permalink: '/docs/1.0.0/',
slug: '/', slug: '/',
@ -1182,8 +1162,7 @@ describe('versioned site', () => {
}); });
await testUtilsLocal.testMeta(path.join('hello.md'), { await testUtilsLocal.testMeta(path.join('hello.md'), {
id: 'version-1.0.0/hello', id: 'hello',
unversionedId: 'hello',
sourceDirName: '.', sourceDirName: '.',
permalink: '/fr/docs/1.0.0/', permalink: '/fr/docs/1.0.0/',
slug: '/', slug: '/',
@ -1220,8 +1199,7 @@ describe('versioned site', () => {
}); });
await testUtilsLocal.testMeta(path.join('hello.md'), { await testUtilsLocal.testMeta(path.join('hello.md'), {
id: 'version-1.0.0/hello', id: 'hello',
unversionedId: 'hello',
sourceDirName: '.', sourceDirName: '.',
permalink: '/fr/docs/1.0.0/', permalink: '/fr/docs/1.0.0/',
slug: '/', slug: '/',

View file

@ -15,21 +15,21 @@ describe('toGlobalDataVersion', () => {
it('generates the right docs, sidebars, and metadata', () => { it('generates the right docs, sidebars, and metadata', () => {
const docs = [ const docs = [
{ {
unversionedId: 'main', id: 'main',
permalink: '/current/main', permalink: '/current/main',
sidebar: 'tutorial', sidebar: 'tutorial',
frontMatter: {}, frontMatter: {},
unlisted: false, unlisted: false,
}, },
{ {
unversionedId: 'doc', id: 'doc',
permalink: '/current/doc', permalink: '/current/doc',
sidebar: 'tutorial', sidebar: 'tutorial',
frontMatter: {}, frontMatter: {},
unlisted: undefined, unlisted: undefined,
}, },
{ {
unversionedId: 'docNoSidebarUnlisted', id: 'docNoSidebarUnlisted',
permalink: '/current/docNoSidebarUnlisted', permalink: '/current/docNoSidebarUnlisted',
sidebar: undefined, sidebar: undefined,
frontMatter: {}, frontMatter: {},
@ -102,7 +102,7 @@ describe('toGlobalDataVersion', () => {
docs, docs,
drafts: [ drafts: [
{ {
unversionedId: 'some-draft-id', id: 'some-draft-id',
permalink: '/current/draft', permalink: '/current/draft',
sidebar: undefined, sidebar: undefined,
}, },

View file

@ -38,26 +38,21 @@ import type {
NormalizedSidebar, NormalizedSidebar,
} from '../sidebars/types'; } from '../sidebars/types';
function findDocById( function findDocById(version: LoadedVersion | undefined, id: string) {
version: LoadedVersion | undefined,
unversionedId: string,
) {
if (!version) { if (!version) {
throw new Error('Version not found'); throw new Error('Version not found');
} }
return version.docs.find((item) => item.unversionedId === unversionedId); return version.docs.find((item) => item.id === id);
} }
function getDocById(version: LoadedVersion | undefined, unversionedId: string) { function getDocById(version: LoadedVersion | undefined, id: string) {
if (!version) { if (!version) {
throw new Error('Version not found'); throw new Error('Version not found');
} }
const doc = findDocById(version, unversionedId); const doc = findDocById(version, id);
if (!doc) { if (!doc) {
throw new Error( throw new Error(
`No doc found with id "${unversionedId}" in version ${ `No doc found with id "${id}" in version ${version.versionName}.
version.versionName Available ids are:\n- ${version.docs.map((d) => d.id).join('\n- ')}`,
}.
Available ids are:\n- ${version.docs.map((d) => d.unversionedId).join('\n- ')}`,
); );
} }
return doc; return doc;

View file

@ -19,6 +19,7 @@ describe('toTagDocListProp', () => {
label: 'tag1', label: 'tag1',
permalink: '/tag1', permalink: '/tag1',
docIds: ['id1', 'id3'], docIds: ['id1', 'id3'],
unlisted: false,
}; };
const doc1 = { const doc1 = {
@ -57,6 +58,7 @@ describe('toTagDocListProp', () => {
count: 2, count: 2,
label: tag.label, label: tag.label,
permalink: tag.permalink, permalink: tag.permalink,
unlisted: false,
items: [doc3, doc1], // Docs sorted by title, ignore "id5" absence items: [doc3, doc1], // Docs sorted by title, ignore "id5" absence
}); });
}); });
@ -69,7 +71,6 @@ describe('toSidebarDocItemLinkProp', () => {
type Doc = Params['doc']; type Doc = Params['doc'];
const id = 'some-doc-id'; const id = 'some-doc-id';
const unversionedId = 'some-unversioned-doc-id';
const item: DocSidebarItem = { const item: DocSidebarItem = {
type: 'doc', type: 'doc',
@ -79,7 +80,6 @@ describe('toSidebarDocItemLinkProp', () => {
const doc: Doc = { const doc: Doc = {
id, id,
unversionedId,
title: 'doc title', title: 'doc title',
permalink: '/docPermalink', permalink: '/docPermalink',
frontMatter: {}, frontMatter: {},
@ -94,7 +94,7 @@ describe('toSidebarDocItemLinkProp', () => {
expect(result).toEqual({ expect(result).toEqual({
type: 'link', type: 'link',
docId: unversionedId, docId: id,
unlisted: false, unlisted: false,
label: item.label, label: item.label,
autoAddBaseUrl: undefined, autoAddBaseUrl: undefined,

View file

@ -30,7 +30,6 @@ function createSampleDoc(doc: Pick<DocMetadata, 'id'>): DocMetadata {
permalink: 'any', permalink: 'any',
slug: 'any', slug: 'any',
source: 'any', source: 'any',
unversionedId: 'any',
version: 'any', version: 'any',
title: `${doc.id} title`, title: `${doc.id} title`,
frontMatter: { frontMatter: {

View file

@ -7,6 +7,7 @@
import path from 'path'; import path from 'path';
import fs from 'fs-extra'; import fs from 'fs-extra';
import _ from 'lodash';
import logger from '@docusaurus/logger'; import logger from '@docusaurus/logger';
import { import {
aliasedSitePath, aliasedSitePath,
@ -24,7 +25,6 @@ import {
import {getFileLastUpdate} from './lastUpdate'; import {getFileLastUpdate} from './lastUpdate';
import getSlug from './slug'; import getSlug from './slug';
import {CURRENT_VERSION_NAME} from './constants';
import {stripPathNumberPrefixes} from './numberPrefix'; import {stripPathNumberPrefixes} from './numberPrefix';
import {validateDocFrontMatter} from './frontMatter'; import {validateDocFrontMatter} from './frontMatter';
import {toDocNavigationLink, toNavigationLink} from './sidebars/utils'; import {toDocNavigationLink, toNavigationLink} from './sidebars/utils';
@ -188,14 +188,6 @@ async function doProcessDocMetadata({
const sidebarPosition: number | undefined = const sidebarPosition: number | undefined =
frontMatter.sidebar_position ?? numberPrefix; frontMatter.sidebar_position ?? numberPrefix;
// TODO legacy retrocompatibility
// The same doc in 2 distinct version could keep the same id,
// we just need to namespace the data by version
const versionIdPrefix =
versionMetadata.versionName === CURRENT_VERSION_NAME
? undefined
: `version-${versionMetadata.versionName}`;
// TODO legacy retrocompatibility // TODO legacy retrocompatibility
// I think it's bad to affect the front matter id with the dirname? // I think it's bad to affect the front matter id with the dirname?
function computeDirNameIdPrefix() { function computeDirNameIdPrefix() {
@ -208,13 +200,7 @@ async function doProcessDocMetadata({
: sourceDirName; : sourceDirName;
} }
const unversionedId = [computeDirNameIdPrefix(), baseID] const id = [computeDirNameIdPrefix(), baseID].filter(Boolean).join('/');
.filter(Boolean)
.join('/');
// TODO is versioning the id very useful in practice?
// legacy versioned id, requires a breaking change to modify this
const id = [versionIdPrefix, unversionedId].filter(Boolean).join('/');
const docSlug = getSlug({ const docSlug = getSlug({
baseID, baseID,
@ -281,7 +267,6 @@ async function doProcessDocMetadata({
// Adding properties to object after instantiation will cause hidden // Adding properties to object after instantiation will cause hidden
// class transitions. // class transitions.
return { return {
unversionedId,
id, id,
title, title,
description, description,
@ -332,22 +317,17 @@ function getUnlistedIds(docs: DocMetadataBase[]): Set<string> {
export function addDocNavigation({ export function addDocNavigation({
docs, docs,
sidebarsUtils, sidebarsUtils,
sidebarFilePath,
}: { }: {
docs: DocMetadataBase[]; docs: DocMetadataBase[];
sidebarsUtils: SidebarsUtils; sidebarsUtils: SidebarsUtils;
sidebarFilePath: string;
}): LoadedVersion['docs'] { }): LoadedVersion['docs'] {
const docsById = createDocsByIdIndex(docs); const docsById = createDocsByIdIndex(docs);
const unlistedIds = getUnlistedIds(docs); const unlistedIds = getUnlistedIds(docs);
sidebarsUtils.checkSidebarsDocIds(docs.flatMap(getDocIds), sidebarFilePath);
// Add sidebar/next/previous to the docs // Add sidebar/next/previous to the docs
function addNavData(doc: DocMetadataBase): DocMetadata { function addNavData(doc: DocMetadataBase): DocMetadata {
const navigation = sidebarsUtils.getDocNavigation({ const navigation = sidebarsUtils.getDocNavigation({
unversionedId: doc.unversionedId, docId: doc.id,
versionedId: doc.id,
displayedSidebar: doc.frontMatter.displayed_sidebar, displayedSidebar: doc.frontMatter.displayed_sidebar,
unlistedIds, unlistedIds,
}); });
@ -412,16 +392,12 @@ export function getMainDocId({
if (versionHomeDoc) { if (versionHomeDoc) {
return versionHomeDoc; return versionHomeDoc;
} else if (firstDocIdOfFirstSidebar) { } else if (firstDocIdOfFirstSidebar) {
return docs.find( return docs.find((doc) => doc.id === firstDocIdOfFirstSidebar)!;
(doc) =>
doc.id === firstDocIdOfFirstSidebar ||
doc.unversionedId === firstDocIdOfFirstSidebar,
)!;
} }
return docs[0]!; return docs[0]!;
} }
return getMainDoc().unversionedId; return getMainDoc().id;
} }
// By convention, Docusaurus considers some docs are "indexes": // By convention, Docusaurus considers some docs are "indexes":
@ -465,25 +441,9 @@ export function toCategoryIndexMatcherParam({
}; };
} }
// Return both doc ids // Docs are indexed by their id
// TODO legacy retro-compatibility due to old versioned sidebars using export function createDocsByIdIndex<Doc extends {id: string}>(
// versioned doc ids ("id" should be removed & "versionedId" should be renamed docs: Doc[],
// to "id") ): {[docId: string]: Doc} {
export function getDocIds(doc: DocMetadataBase): [string, string] { return _.keyBy(docs, (d) => d.id);
return [doc.unversionedId, doc.id];
}
// Docs are indexed by both versioned and unversioned ids at the same time
// TODO legacy retro-compatibility due to old versioned sidebars using
// versioned doc ids ("id" should be removed & "versionedId" should be renamed
// to "id")
export function createDocsByIdIndex<
Doc extends {id: string; unversionedId: string},
>(docs: Doc[]): {[docId: string]: Doc} {
return Object.fromEntries(
docs.flatMap((doc) => [
[doc.unversionedId, doc],
[doc.id, doc],
]),
);
} }

View file

@ -21,7 +21,7 @@ import type {Sidebars} from './sidebars/types';
function toGlobalDataDoc(doc: DocMetadata): GlobalDoc { function toGlobalDataDoc(doc: DocMetadata): GlobalDoc {
return { return {
id: doc.unversionedId, id: doc.id,
path: doc.permalink, path: doc.permalink,
// optimize global data size: do not add unlisted: false/undefined // optimize global data size: do not add unlisted: false/undefined
@ -56,10 +56,7 @@ function toGlobalSidebars(
path: path:
firstLink.type === 'generated-index' firstLink.type === 'generated-index'
? firstLink.permalink ? firstLink.permalink
: version.docs.find( : version.docs.find((doc) => doc.id === firstLink.id)!.permalink,
(doc) =>
doc.id === firstLink.id || doc.unversionedId === firstLink.id,
)!.permalink,
label: firstLink.label, label: firstLink.label,
}, },
}; };
@ -76,7 +73,7 @@ export function toGlobalDataVersion(version: FullVersion): GlobalVersion {
docs: version.docs docs: version.docs
.map(toGlobalDataDoc) .map(toGlobalDataDoc)
.concat(version.categoryGeneratedIndices.map(toGlobalDataGeneratedIndex)), .concat(version.categoryGeneratedIndices.map(toGlobalDataGeneratedIndex)),
draftIds: version.drafts.map((doc) => doc.unversionedId), draftIds: version.drafts.map((doc) => doc.id),
sidebars: toGlobalSidebars(version.sidebars, version), sidebars: toGlobalSidebars(version.sidebars, version),
}; };
} }

View file

@ -26,6 +26,7 @@ import {
processDocMetadata, processDocMetadata,
addDocNavigation, addDocNavigation,
type DocEnv, type DocEnv,
createDocsByIdIndex,
} from './docs'; } from './docs';
import {readVersionsMetadata, toFullVersion} from './versions'; import {readVersionsMetadata, toFullVersion} from './versions';
import {cliDocsVersionCommand} from './cli'; import {cliDocsVersionCommand} from './cli';
@ -179,12 +180,24 @@ export default async function pluginContentDocs(
const sidebarsUtils = createSidebarsUtils(sidebars); const sidebarsUtils = createSidebarsUtils(sidebars);
const docsById = createDocsByIdIndex(docs);
const allDocIds = Object.keys(docsById);
sidebarsUtils.checkLegacyVersionedSidebarNames({
sidebarFilePath: versionMetadata.sidebarFilePath as string,
versionMetadata,
});
sidebarsUtils.checkSidebarsDocIds({
allDocIds,
sidebarFilePath: versionMetadata.sidebarFilePath as string,
versionMetadata,
});
return { return {
...versionMetadata, ...versionMetadata,
docs: addDocNavigation({ docs: addDocNavigation({
docs, docs,
sidebarsUtils, sidebarsUtils,
sidebarFilePath: versionMetadata.sidebarFilePath as string,
}), }),
drafts, drafts,
sidebars, sidebars,

View file

@ -414,17 +414,11 @@ declare module '@docusaurus/plugin-content-docs' {
}; };
export type DocMetadataBase = LastUpdateData & { export type DocMetadataBase = LastUpdateData & {
// TODO
/** /**
* Legacy versioned ID. Will be refactored in the future to be unversioned. * The document id.
* Multiple documents can have the same id, when in different versions.
*/ */
id: string; id: string;
// TODO
/**
* Unversioned ID. Should be preferred everywhere over `id` until the latter
* is refactored.
*/
unversionedId: string;
/** The name of the version this doc belongs to. */ /** The name of the version this doc belongs to. */
version: string; version: string;
/** /**

View file

@ -35,10 +35,11 @@ export function toSidebarDocItemLinkProp({
item: SidebarItemDoc; item: SidebarItemDoc;
doc: Pick< doc: Pick<
DocMetadata, DocMetadata,
'id' | 'title' | 'permalink' | 'unlisted' | 'frontMatter' | 'unversionedId' 'id' | 'title' | 'permalink' | 'unlisted' | 'frontMatter'
>; >;
}): PropSidebarItemLink { }): PropSidebarItemLink {
const { const {
id,
title, title,
permalink, permalink,
frontMatter: { frontMatter: {
@ -46,7 +47,6 @@ export function toSidebarDocItemLinkProp({
sidebar_custom_props: customProps, sidebar_custom_props: customProps,
}, },
unlisted, unlisted,
unversionedId,
} = doc; } = doc;
return { return {
type: 'link', type: 'link',
@ -54,7 +54,7 @@ export function toSidebarDocItemLinkProp({
href: permalink, href: permalink,
className: item.className, className: item.className,
customProps: item.customProps ?? customProps, customProps: item.customProps ?? customProps,
docId: unversionedId, docId: id,
unlisted, unlisted,
}; };
} }
@ -151,9 +151,9 @@ Available document ids are:
function toVersionDocsProp(loadedVersion: LoadedVersion): PropVersionDocs { function toVersionDocsProp(loadedVersion: LoadedVersion): PropVersionDocs {
return Object.fromEntries( return Object.fromEntries(
loadedVersion.docs.map((doc) => [ loadedVersion.docs.map((doc) => [
doc.unversionedId, doc.id,
{ {
id: doc.unversionedId, id: doc.id,
title: doc.title, title: doc.title,
description: doc.description, description: doc.description,
sidebar: doc.sidebar, sidebar: doc.sidebar,

View file

@ -67,7 +67,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebar_custom_props: {custom: 'prop'}, sidebar_custom_props: {custom: 'prop'},
}, },
title: '', title: '',
unversionedId: 'doc1',
}, },
{ {
id: 'doc2', id: 'doc2',
@ -76,7 +75,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 3, sidebarPosition: 3,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'doc2',
}, },
{ {
id: 'doc3', id: 'doc3',
@ -85,7 +83,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 1, sidebarPosition: 1,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'doc3',
}, },
{ {
id: 'doc4', id: 'doc4',
@ -94,7 +91,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 1.5, sidebarPosition: 1.5,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'doc4',
}, },
{ {
id: 'doc5', id: 'doc5',
@ -103,7 +99,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: undefined, sidebarPosition: undefined,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'doc5',
}, },
], ],
isCategoryIndex: () => false, isCategoryIndex: () => false,
@ -150,7 +145,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 0, sidebarPosition: 0,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'intro',
}, },
{ {
id: 'tutorials-index', id: 'tutorials-index',
@ -159,7 +153,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 2, sidebarPosition: 2,
frontMatter: {}, frontMatter: {},
title: 'Tutorials', title: 'Tutorials',
unversionedId: 'tutorials-index',
}, },
{ {
id: 'tutorial2', id: 'tutorial2',
@ -168,7 +161,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 2, sidebarPosition: 2,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'tutorial2',
}, },
{ {
id: 'tutorial1', id: 'tutorial1',
@ -177,7 +169,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 1, sidebarPosition: 1,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'tutorial1',
}, },
{ {
id: 'guides-index', id: 'guides-index',
@ -185,7 +176,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sourceDirName: '02-Guides', sourceDirName: '02-Guides',
frontMatter: {}, frontMatter: {},
title: 'Guides', title: 'Guides',
unversionedId: 'guides-index',
}, },
{ {
id: 'guide2', id: 'guide2',
@ -194,7 +184,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 2, sidebarPosition: 2,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'guide2',
}, },
{ {
id: 'guide1', id: 'guide1',
@ -205,7 +194,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebar_class_name: 'foo', sidebar_class_name: 'foo',
}, },
title: '', title: '',
unversionedId: 'guide1',
}, },
{ {
id: 'nested-guide', id: 'nested-guide',
@ -214,7 +202,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: undefined, sidebarPosition: undefined,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'nested-guide',
}, },
{ {
id: 'end', id: 'end',
@ -223,7 +210,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 3, sidebarPosition: 3,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'end',
}, },
], ],
}); });
@ -268,7 +254,6 @@ describe('DefaultSidebarItemsGenerator', () => {
title: 'Subsubsubfolder category label', title: 'Subsubsubfolder category label',
sidebarPosition: undefined, sidebarPosition: undefined,
frontMatter: {}, frontMatter: {},
unversionedId: 'doc1',
}, },
{ {
id: 'doc2', id: 'doc2',
@ -277,7 +262,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: undefined, sidebarPosition: undefined,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'doc2',
}, },
{ {
id: 'doc3', id: 'doc3',
@ -286,7 +270,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: undefined, sidebarPosition: undefined,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'doc2',
}, },
{ {
id: 'doc4', id: 'doc4',
@ -295,7 +278,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: undefined, sidebarPosition: undefined,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'doc4',
}, },
{ {
id: 'doc5', id: 'doc5',
@ -304,7 +286,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: undefined, sidebarPosition: undefined,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'doc5',
}, },
{ {
id: 'doc6', id: 'doc6',
@ -313,7 +294,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: undefined, sidebarPosition: undefined,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'doc6',
}, },
{ {
id: 'doc7', id: 'doc7',
@ -322,7 +302,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 2, sidebarPosition: 2,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'doc7',
}, },
{ {
id: 'doc8', id: 'doc8',
@ -331,7 +310,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 1, sidebarPosition: 1,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'doc8',
}, },
], ],
}); });
@ -370,7 +348,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sourceDirName: 'Category', sourceDirName: 'Category',
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'parent/doc1',
}, },
{ {
id: 'parent/doc2', id: 'parent/doc2',
@ -378,7 +355,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sourceDirName: 'Category', sourceDirName: 'Category',
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'parent/doc2',
}, },
{ {
id: 'parent/doc3', id: 'parent/doc3',
@ -386,7 +362,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sourceDirName: 'Category', sourceDirName: 'Category',
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'parent/doc3',
}, },
{ {
id: 'parent/doc4', id: 'parent/doc4',
@ -394,7 +369,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sourceDirName: 'Category2', sourceDirName: 'Category2',
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'parent/doc4',
}, },
{ {
id: 'parent/doc5', id: 'parent/doc5',
@ -402,7 +376,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sourceDirName: 'Category2', sourceDirName: 'Category2',
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'parent/doc5',
}, },
{ {
id: 'parent/doc6', id: 'parent/doc6',
@ -410,7 +383,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sourceDirName: 'Category2', sourceDirName: 'Category2',
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'parent/doc6',
}, },
], ],
isCategoryIndex: () => false, isCategoryIndex: () => false,
@ -449,7 +421,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 0, sidebarPosition: 0,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'intro',
}, },
{ {
id: 'tutorials-index', id: 'tutorials-index',
@ -458,7 +429,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 2, sidebarPosition: 2,
frontMatter: {}, frontMatter: {},
title: 'Tutorials', title: 'Tutorials',
unversionedId: 'tutorials-index',
}, },
{ {
id: 'tutorial2', id: 'tutorial2',
@ -467,7 +437,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 2, sidebarPosition: 2,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'tutorial2',
}, },
{ {
id: 'tutorial1', id: 'tutorial1',
@ -476,7 +445,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 1, sidebarPosition: 1,
frontMatter: {}, frontMatter: {},
title: '', title: '',
unversionedId: 'tutorial1',
}, },
{ {
id: 'not-guides-index', id: 'not-guides-index',
@ -484,7 +452,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sourceDirName: '02-Guides', sourceDirName: '02-Guides',
frontMatter: {}, frontMatter: {},
title: 'Guides', title: 'Guides',
unversionedId: 'not-guides-index',
}, },
{ {
id: 'guide2', id: 'guide2',
@ -493,7 +460,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 2, sidebarPosition: 2,
frontMatter: {}, frontMatter: {},
title: 'guide2', title: 'guide2',
unversionedId: 'guide2',
}, },
{ {
id: 'guide1', id: 'guide1',
@ -504,7 +470,6 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebar_class_name: 'foo', sidebar_class_name: 'foo',
}, },
title: '', title: '',
unversionedId: 'guide1',
}, },
], ],
}); });
@ -536,7 +501,6 @@ describe('DefaultSidebarItemsGenerator', () => {
docs: [ docs: [
{ {
id: 'intro', id: 'intro',
unversionedId: 'intro',
source: '@site/docs/category/intro.md', source: '@site/docs/category/intro.md',
sourceDirName: 'category', sourceDirName: 'category',
frontMatter: {}, frontMatter: {},

View file

@ -155,7 +155,7 @@ describe('postProcess', () => {
{ {
sidebarOptions: {sidebarCollapsed: true, sidebarCollapsible: true}, sidebarOptions: {sidebarCollapsed: true, sidebarCollapsible: true},
version: {path: 'version'}, version: {path: 'version'},
drafts: [{id: 'foo', unversionedId: 'foo'}], drafts: [{id: 'foo'}],
} as unknown as SidebarPostProcessorParams, } as unknown as SidebarPostProcessorParams,
), ),
).toMatchSnapshot(); ).toMatchSnapshot();

View file

@ -155,8 +155,7 @@ describe('createSidebarsUtils', () => {
it('getDocNavigation', () => { it('getDocNavigation', () => {
expect( expect(
getDocNavigation({ getDocNavigation({
unversionedId: 'doc1', docId: 'doc1',
versionedId: 'doc1',
displayedSidebar: undefined, displayedSidebar: undefined,
unlistedIds: new Set(), unlistedIds: new Set(),
}), }),
@ -170,8 +169,7 @@ describe('createSidebarsUtils', () => {
}); });
expect( expect(
getDocNavigation({ getDocNavigation({
unversionedId: 'doc2', docId: 'doc2',
versionedId: 'doc2',
displayedSidebar: undefined, displayedSidebar: undefined,
unlistedIds: new Set(), unlistedIds: new Set(),
}), }),
@ -186,8 +184,7 @@ describe('createSidebarsUtils', () => {
expect( expect(
getDocNavigation({ getDocNavigation({
unversionedId: 'doc3', docId: 'doc3',
versionedId: 'doc3',
displayedSidebar: undefined, displayedSidebar: undefined,
unlistedIds: new Set(), unlistedIds: new Set(),
}), }),
@ -201,8 +198,7 @@ describe('createSidebarsUtils', () => {
}); });
expect( expect(
getDocNavigation({ getDocNavigation({
unversionedId: 'doc4', docId: 'doc4',
versionedId: 'doc4',
displayedSidebar: undefined, displayedSidebar: undefined,
unlistedIds: new Set(), unlistedIds: new Set(),
}), }),
@ -218,8 +214,7 @@ describe('createSidebarsUtils', () => {
expect( expect(
getDocNavigation({ getDocNavigation({
unversionedId: 'doc5', docId: 'doc5',
versionedId: 'doc5',
displayedSidebar: undefined, displayedSidebar: undefined,
unlistedIds: new Set(), unlistedIds: new Set(),
}), }),
@ -233,8 +228,7 @@ describe('createSidebarsUtils', () => {
}); });
expect( expect(
getDocNavigation({ getDocNavigation({
unversionedId: 'doc6', docId: 'doc6',
versionedId: 'doc6',
displayedSidebar: undefined, displayedSidebar: undefined,
unlistedIds: new Set(), unlistedIds: new Set(),
}), }),
@ -251,8 +245,7 @@ describe('createSidebarsUtils', () => {
}); });
expect( expect(
getDocNavigation({ getDocNavigation({
unversionedId: 'doc7', docId: 'doc7',
versionedId: 'doc7',
displayedSidebar: undefined, displayedSidebar: undefined,
unlistedIds: new Set(), unlistedIds: new Set(),
}), }),
@ -266,8 +259,7 @@ describe('createSidebarsUtils', () => {
}); });
expect( expect(
getDocNavigation({ getDocNavigation({
unversionedId: 'doc3', docId: 'doc3',
versionedId: 'doc3',
displayedSidebar: null, displayedSidebar: null,
unlistedIds: new Set(), unlistedIds: new Set(),
}), }),
@ -278,8 +270,7 @@ describe('createSidebarsUtils', () => {
}); });
expect(() => expect(() =>
getDocNavigation({ getDocNavigation({
unversionedId: 'doc3', docId: 'doc3',
versionedId: 'doc3',
displayedSidebar: 'foo', displayedSidebar: 'foo',
unlistedIds: new Set(), unlistedIds: new Set(),
}), }),
@ -288,8 +279,7 @@ describe('createSidebarsUtils', () => {
); );
expect( expect(
getDocNavigation({ getDocNavigation({
unversionedId: 'doc3', docId: 'doc3',
versionedId: 'doc3',
displayedSidebar: 'sidebar1', displayedSidebar: 'sidebar1',
unlistedIds: new Set(), unlistedIds: new Set(),
}), }),

View file

@ -7,7 +7,6 @@
import _ from 'lodash'; import _ from 'lodash';
import {normalizeUrl} from '@docusaurus/utils'; import {normalizeUrl} from '@docusaurus/utils';
import {getDocIds} from '../docs';
import type { import type {
SidebarItem, SidebarItem,
Sidebars, Sidebars,
@ -102,7 +101,7 @@ export function postProcessSidebars(
sidebars: ProcessedSidebars, sidebars: ProcessedSidebars,
params: SidebarProcessorParams, params: SidebarProcessorParams,
): Sidebars { ): Sidebars {
const draftIds = new Set(params.drafts.flatMap(getDocIds)); const draftIds = new Set(params.drafts.map((d) => d.id));
return _.mapValues(sidebars, (sidebar) => return _.mapValues(sidebars, (sidebar) =>
sidebar sidebar

View file

@ -33,7 +33,6 @@ function toSidebarItemsGeneratorDoc(
): SidebarItemsGeneratorDoc { ): SidebarItemsGeneratorDoc {
return _.pick(doc, [ return _.pick(doc, [
'id', 'id',
'unversionedId',
'title', 'title',
'frontMatter', 'frontMatter',
'source', 'source',

View file

@ -235,7 +235,6 @@ export type CategoryMetadataFile = {
export type SidebarItemsGeneratorDoc = Pick< export type SidebarItemsGeneratorDoc = Pick<
DocMetadataBase, DocMetadataBase,
| 'id' | 'id'
| 'unversionedId'
| 'title' | 'title'
| 'frontMatter' | 'frontMatter'
| 'source' | 'source'

View file

@ -23,6 +23,7 @@ import type {
import type { import type {
DocMetadataBase, DocMetadataBase,
PropNavigationLink, PropNavigationLink,
VersionMetadata,
} from '@docusaurus/plugin-content-docs'; } from '@docusaurus/plugin-content-docs';
export function isCategoriesShorthand( export function isCategoriesShorthand(
@ -136,8 +137,7 @@ export type SidebarsUtils = {
getFirstDocIdOfFirstSidebar: () => string | undefined; getFirstDocIdOfFirstSidebar: () => string | undefined;
getSidebarNameByDocId: (docId: string) => string | undefined; getSidebarNameByDocId: (docId: string) => string | undefined;
getDocNavigation: (params: { getDocNavigation: (params: {
unversionedId: string; docId: string;
versionedId: string;
displayedSidebar: string | null | undefined; displayedSidebar: string | null | undefined;
unlistedIds: Set<string>; unlistedIds: Set<string>;
}) => SidebarNavigation; }) => SidebarNavigation;
@ -163,7 +163,22 @@ export type SidebarsUtils = {
} }
| undefined; | undefined;
checkSidebarsDocIds: (validDocIds: string[], sidebarFilePath: string) => void; checkLegacyVersionedSidebarNames: ({
versionMetadata,
}: {
sidebarFilePath: string;
versionMetadata: VersionMetadata;
}) => void;
checkSidebarsDocIds: ({
allDocIds,
sidebarFilePath,
versionMetadata,
}: {
allDocIds: string[];
sidebarFilePath: string;
versionMetadata: VersionMetadata;
}) => void;
}; };
export function createSidebarsUtils(sidebars: Sidebars): SidebarsUtils { export function createSidebarsUtils(sidebars: Sidebars): SidebarsUtils {
@ -194,26 +209,18 @@ export function createSidebarsUtils(sidebars: Sidebars): SidebarsUtils {
} }
function getDocNavigation({ function getDocNavigation({
unversionedId, docId,
versionedId,
displayedSidebar, displayedSidebar,
unlistedIds, unlistedIds,
}: { }: {
unversionedId: string; docId: string;
versionedId: string;
displayedSidebar: string | null | undefined; displayedSidebar: string | null | undefined;
unlistedIds: Set<string>; unlistedIds: Set<string>;
}): SidebarNavigation { }): SidebarNavigation {
// TODO legacy id retro-compatibility! const sidebarName =
let docId = unversionedId;
let sidebarName =
displayedSidebar === undefined displayedSidebar === undefined
? getSidebarNameByDocId(docId) ? getSidebarNameByDocId(docId)
: displayedSidebar; : displayedSidebar;
if (sidebarName === undefined) {
docId = versionedId;
sidebarName = getSidebarNameByDocId(docId);
}
if (!sidebarName) { if (!sidebarName) {
return emptySidebarNavigation(); return emptySidebarNavigation();
@ -303,19 +310,115 @@ export function createSidebarsUtils(sidebars: Sidebars): SidebarsUtils {
}; };
} }
function checkSidebarsDocIds(validDocIds: string[], sidebarFilePath: string) { // TODO remove in Docusaurus v4
function getLegacyVersionedPrefix(versionMetadata: VersionMetadata): string {
return `version-${versionMetadata.versionName}/`;
}
// In early v2, sidebar names used to be versioned
// example: "version-2.0.0-alpha.66/my-sidebar-name"
// In v3 it's not the case anymore and we throw an error to explain
// TODO remove in Docusaurus v4
function checkLegacyVersionedSidebarNames({
versionMetadata,
sidebarFilePath,
}: {
versionMetadata: VersionMetadata;
sidebarFilePath: string;
}): void {
const illegalPrefix = getLegacyVersionedPrefix(versionMetadata);
const legacySidebarNames = Object.keys(sidebars).filter((sidebarName) =>
sidebarName.startsWith(illegalPrefix),
);
if (legacySidebarNames.length > 0) {
throw new Error(
`Invalid sidebar file at "${toMessageRelativeFilePath(
sidebarFilePath,
)}".
These legacy versioned sidebar names are not supported anymore in Docusaurus v3:
- ${legacySidebarNames.sort().join('\n- ')}
The sidebar names you should now use are:
- ${legacySidebarNames
.sort()
.map((legacyName) => legacyName.split('/').splice(1).join('/'))
.join('\n- ')}
Please remove the "${illegalPrefix}" prefix from your versioned sidebar file.
This breaking change is documented on Docusaurus v3 release notes: https://docusaurus.io/blog/releases/3.0
`,
);
}
}
// throw a better error message for Docusaurus v3 breaking change
// TODO this can be removed in Docusaurus v4
function handleLegacyVersionedDocIds({
invalidDocIds,
sidebarFilePath,
versionMetadata,
}: {
invalidDocIds: string[];
sidebarFilePath: string;
versionMetadata: VersionMetadata;
}) {
const illegalPrefix = getLegacyVersionedPrefix(versionMetadata);
// In older v2.0 alpha/betas, versioned docs had a legacy versioned prefix
// Example: "version-1.4/my-doc-id"
//
const legacyVersionedDocIds = invalidDocIds.filter((docId) =>
docId.startsWith(illegalPrefix),
);
if (legacyVersionedDocIds.length > 0) {
throw new Error(
`Invalid sidebar file at "${toMessageRelativeFilePath(
sidebarFilePath,
)}".
These legacy versioned document ids are not supported anymore in Docusaurus v3:
- ${legacyVersionedDocIds.sort().join('\n- ')}
The document ids you should now use are:
- ${legacyVersionedDocIds
.sort()
.map((legacyId) => legacyId.split('/').splice(1).join('/'))
.join('\n- ')}
Please remove the "${illegalPrefix}" prefix from your versioned sidebar file.
This breaking change is documented on Docusaurus v3 release notes: https://docusaurus.io/blog/releases/3.0
`,
);
}
}
function checkSidebarsDocIds({
allDocIds,
sidebarFilePath,
versionMetadata,
}: {
allDocIds: string[];
sidebarFilePath: string;
versionMetadata: VersionMetadata;
}) {
const allSidebarDocIds = Object.values(sidebarNameToDocIds).flat(); const allSidebarDocIds = Object.values(sidebarNameToDocIds).flat();
const invalidSidebarDocIds = _.difference(allSidebarDocIds, validDocIds); const invalidDocIds = _.difference(allSidebarDocIds, allDocIds);
if (invalidSidebarDocIds.length > 0) {
if (invalidDocIds.length > 0) {
handleLegacyVersionedDocIds({
invalidDocIds,
sidebarFilePath,
versionMetadata,
});
throw new Error( throw new Error(
`Invalid sidebar file at "${toMessageRelativeFilePath( `Invalid sidebar file at "${toMessageRelativeFilePath(
sidebarFilePath, sidebarFilePath,
)}". )}".
These sidebar document ids do not exist: These sidebar document ids do not exist:
- ${invalidSidebarDocIds.sort().join('\n- ')} - ${invalidDocIds.sort().join('\n- ')}
Available document ids are: Available document ids are:
- ${_.uniq(validDocIds).sort().join('\n- ')}`, - ${_.uniq(allDocIds).sort().join('\n- ')}
`,
); );
} }
} }
@ -369,6 +472,7 @@ Available document ids are:
getDocNavigation, getDocNavigation,
getCategoryGeneratedIndexList, getCategoryGeneratedIndexList,
getCategoryGeneratedIndexNavigation, getCategoryGeneratedIndexNavigation,
checkLegacyVersionedSidebarNames,
checkSidebarsDocIds, checkSidebarsDocIds,
getFirstLink: (id) => getFirstLink(sidebars[id]!), getFirstLink: (id) => getFirstLink(sidebars[id]!),
}; };

View file

@ -40,23 +40,6 @@ function getVersionFileName(versionName: string): string {
return `version-${versionName}`; return `version-${versionName}`;
} }
// TODO legacy, the sidebar name is like "version-2.0.0-alpha.66/docs"
// input: "version-2.0.0-alpha.66/docs"
// output: "docs"
function getNormalizedSidebarName({
versionName,
sidebarName,
}: {
versionName: string;
sidebarName: string;
}): string {
if (versionName === CURRENT_VERSION_NAME || !sidebarName.includes('/')) {
return sidebarName;
}
const [, ...rest] = sidebarName.split('/');
return rest.join('/');
}
function getSidebarTranslationFileContent( function getSidebarTranslationFileContent(
sidebar: Sidebar, sidebar: Sidebar,
sidebarName: string, sidebarName: string,
@ -199,13 +182,9 @@ function getSidebarsTranslations(
version: LoadedVersion, version: LoadedVersion,
): TranslationFileContent { ): TranslationFileContent {
return mergeTranslations( return mergeTranslations(
Object.entries(version.sidebars).map(([sidebarName, sidebar]) => { Object.entries(version.sidebars).map(([sidebarName, sidebar]) =>
const normalizedSidebarName = getNormalizedSidebarName({ getSidebarTranslationFileContent(sidebar, sidebarName),
sidebarName, ),
versionName: version.versionName,
});
return getSidebarTranslationFileContent(sidebar, normalizedSidebarName);
}),
); );
} }
function translateSidebars( function translateSidebars(
@ -215,10 +194,7 @@ function translateSidebars(
return _.mapValues(version.sidebars, (sidebar, sidebarName) => return _.mapValues(version.sidebars, (sidebar, sidebarName) =>
translateSidebar({ translateSidebar({
sidebar, sidebar,
sidebarName: getNormalizedSidebarName({
sidebarName, sidebarName,
versionName: version.versionName,
}),
sidebarsTranslations, sidebarsTranslations,
}), }),
); );

View file

@ -13,7 +13,7 @@ import DocItemLayout from '@theme/DocItem/Layout';
import type {Props} from '@theme/DocItem'; import type {Props} from '@theme/DocItem';
export default function DocItem(props: Props): JSX.Element { export default function DocItem(props: Props): JSX.Element {
const docHtmlClassName = `docs-doc-id-${props.content.metadata.unversionedId}`; const docHtmlClassName = `docs-doc-id-${props.content.metadata.id}`;
const MDXComponent = props.content; const MDXComponent = props.content;
return ( return (
<DocProvider content={props.content}> <DocProvider content={props.content}>