mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-03 12:17:20 +02:00
fix(docs): create tags route if only tags exists (#5606)
This commit is contained in:
parent
81877d7582
commit
e66e045b74
2 changed files with 16 additions and 57 deletions
|
@ -1019,8 +1019,6 @@ Object {
|
|||
},
|
||||
\\"sidebar\\": \\"community\\"
|
||||
}",
|
||||
"tags-list-1-0-0-prop-483.json": "[]",
|
||||
"tags-list-current-prop-15a.json": "[]",
|
||||
"version-1-0-0-metadata-prop-608.json": "{
|
||||
\\"pluginId\\": \\"community\\",
|
||||
\\"version\\": \\"1.0.0\\",
|
||||
|
@ -1102,22 +1100,6 @@ Object {
|
|||
|
||||
exports[`versioned website (community) content: route config 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"component": "@theme/DocTagsListPage",
|
||||
"exact": true,
|
||||
"modules": Object {
|
||||
"tags": "~docs/tags-list-current-prop-15a.json",
|
||||
},
|
||||
"path": "/community/next/tags",
|
||||
},
|
||||
Object {
|
||||
"component": "@theme/DocTagsListPage",
|
||||
"exact": true,
|
||||
"modules": Object {
|
||||
"tags": "~docs/tags-list-1-0-0-prop-483.json",
|
||||
},
|
||||
"path": "/community/tags",
|
||||
},
|
||||
Object {
|
||||
"component": "@theme/DocPage",
|
||||
"exact": false,
|
||||
|
@ -1654,8 +1636,6 @@ Object {
|
|||
],
|
||||
\\"allTagsPath\\": \\"/docs/next/tags\\"
|
||||
}",
|
||||
"tags-list-1-0-0-prop-483.json": "[]",
|
||||
"tags-list-1-0-1-prop-c39.json": "[]",
|
||||
"tags-list-current-prop-15a.json": "[
|
||||
{
|
||||
\\"name\\": \\"barTag 1\\",
|
||||
|
@ -1673,7 +1653,6 @@ Object {
|
|||
\\"count\\": 1
|
||||
}
|
||||
]",
|
||||
"tags-list-with-slugs-prop-1ca.json": "[]",
|
||||
"version-1-0-0-metadata-prop-608.json": "{
|
||||
\\"pluginId\\": \\"default\\",
|
||||
\\"version\\": \\"1.0.0\\",
|
||||
|
@ -1970,14 +1949,6 @@ Object {
|
|||
|
||||
exports[`versioned website content: route config 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"component": "@theme/DocTagsListPage",
|
||||
"exact": true,
|
||||
"modules": Object {
|
||||
"tags": "~docs/tags-list-1-0-0-prop-483.json",
|
||||
},
|
||||
"path": "/docs/1.0.0/tags",
|
||||
},
|
||||
Object {
|
||||
"component": "@theme/DocTagsListPage",
|
||||
"exact": true,
|
||||
|
@ -2010,22 +1981,6 @@ Array [
|
|||
},
|
||||
"path": "/docs/next/tags/barTag-3-permalink",
|
||||
},
|
||||
Object {
|
||||
"component": "@theme/DocTagsListPage",
|
||||
"exact": true,
|
||||
"modules": Object {
|
||||
"tags": "~docs/tags-list-1-0-1-prop-c39.json",
|
||||
},
|
||||
"path": "/docs/tags",
|
||||
},
|
||||
Object {
|
||||
"component": "@theme/DocTagsListPage",
|
||||
"exact": true,
|
||||
"modules": Object {
|
||||
"tags": "~docs/tags-list-with-slugs-prop-1ca.json",
|
||||
},
|
||||
"path": "/docs/withSlugs/tags",
|
||||
},
|
||||
Object {
|
||||
"component": "@theme/DocPage",
|
||||
"exact": false,
|
||||
|
|
|
@ -328,18 +328,22 @@ export default function pluginContentDocs(
|
|||
permalink: tagValue.permalink,
|
||||
count: tagValue.docIds.length,
|
||||
}));
|
||||
const tagsPropPath = await createData(
|
||||
`${docuHash(`tags-list-${loadedVersion.versionName}-prop`)}.json`,
|
||||
JSON.stringify(tagsProp, null, 2),
|
||||
);
|
||||
addRoute({
|
||||
path: loadedVersion.tagsPath,
|
||||
exact: true,
|
||||
component: options.docTagsListComponent,
|
||||
modules: {
|
||||
tags: aliasedSource(tagsPropPath),
|
||||
},
|
||||
});
|
||||
|
||||
// Only create /tags page if there are tags.
|
||||
if (Object.keys(tagsProp).length > 0) {
|
||||
const tagsPropPath = await createData(
|
||||
`${docuHash(`tags-list-${loadedVersion.versionName}-prop`)}.json`,
|
||||
JSON.stringify(tagsProp, null, 2),
|
||||
);
|
||||
addRoute({
|
||||
path: loadedVersion.tagsPath,
|
||||
exact: true,
|
||||
component: options.docTagsListComponent,
|
||||
modules: {
|
||||
tags: aliasedSource(tagsPropPath),
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function createTagDocListPage(tag: VersionTag) {
|
||||
|
|
Loading…
Add table
Reference in a new issue