mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 04:37:28 +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\\"
|
\\"sidebar\\": \\"community\\"
|
||||||
}",
|
}",
|
||||||
"tags-list-1-0-0-prop-483.json": "[]",
|
|
||||||
"tags-list-current-prop-15a.json": "[]",
|
|
||||||
"version-1-0-0-metadata-prop-608.json": "{
|
"version-1-0-0-metadata-prop-608.json": "{
|
||||||
\\"pluginId\\": \\"community\\",
|
\\"pluginId\\": \\"community\\",
|
||||||
\\"version\\": \\"1.0.0\\",
|
\\"version\\": \\"1.0.0\\",
|
||||||
|
@ -1102,22 +1100,6 @@ Object {
|
||||||
|
|
||||||
exports[`versioned website (community) content: route config 1`] = `
|
exports[`versioned website (community) content: route config 1`] = `
|
||||||
Array [
|
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 {
|
Object {
|
||||||
"component": "@theme/DocPage",
|
"component": "@theme/DocPage",
|
||||||
"exact": false,
|
"exact": false,
|
||||||
|
@ -1654,8 +1636,6 @@ Object {
|
||||||
],
|
],
|
||||||
\\"allTagsPath\\": \\"/docs/next/tags\\"
|
\\"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": "[
|
"tags-list-current-prop-15a.json": "[
|
||||||
{
|
{
|
||||||
\\"name\\": \\"barTag 1\\",
|
\\"name\\": \\"barTag 1\\",
|
||||||
|
@ -1673,7 +1653,6 @@ Object {
|
||||||
\\"count\\": 1
|
\\"count\\": 1
|
||||||
}
|
}
|
||||||
]",
|
]",
|
||||||
"tags-list-with-slugs-prop-1ca.json": "[]",
|
|
||||||
"version-1-0-0-metadata-prop-608.json": "{
|
"version-1-0-0-metadata-prop-608.json": "{
|
||||||
\\"pluginId\\": \\"default\\",
|
\\"pluginId\\": \\"default\\",
|
||||||
\\"version\\": \\"1.0.0\\",
|
\\"version\\": \\"1.0.0\\",
|
||||||
|
@ -1970,14 +1949,6 @@ Object {
|
||||||
|
|
||||||
exports[`versioned website content: route config 1`] = `
|
exports[`versioned website content: route config 1`] = `
|
||||||
Array [
|
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 {
|
Object {
|
||||||
"component": "@theme/DocTagsListPage",
|
"component": "@theme/DocTagsListPage",
|
||||||
"exact": true,
|
"exact": true,
|
||||||
|
@ -2010,22 +1981,6 @@ Array [
|
||||||
},
|
},
|
||||||
"path": "/docs/next/tags/barTag-3-permalink",
|
"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 {
|
Object {
|
||||||
"component": "@theme/DocPage",
|
"component": "@theme/DocPage",
|
||||||
"exact": false,
|
"exact": false,
|
||||||
|
|
|
@ -328,18 +328,22 @@ export default function pluginContentDocs(
|
||||||
permalink: tagValue.permalink,
|
permalink: tagValue.permalink,
|
||||||
count: tagValue.docIds.length,
|
count: tagValue.docIds.length,
|
||||||
}));
|
}));
|
||||||
const tagsPropPath = await createData(
|
|
||||||
`${docuHash(`tags-list-${loadedVersion.versionName}-prop`)}.json`,
|
// Only create /tags page if there are tags.
|
||||||
JSON.stringify(tagsProp, null, 2),
|
if (Object.keys(tagsProp).length > 0) {
|
||||||
);
|
const tagsPropPath = await createData(
|
||||||
addRoute({
|
`${docuHash(`tags-list-${loadedVersion.versionName}-prop`)}.json`,
|
||||||
path: loadedVersion.tagsPath,
|
JSON.stringify(tagsProp, null, 2),
|
||||||
exact: true,
|
);
|
||||||
component: options.docTagsListComponent,
|
addRoute({
|
||||||
modules: {
|
path: loadedVersion.tagsPath,
|
||||||
tags: aliasedSource(tagsPropPath),
|
exact: true,
|
||||||
},
|
component: options.docTagsListComponent,
|
||||||
});
|
modules: {
|
||||||
|
tags: aliasedSource(tagsPropPath),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createTagDocListPage(tag: VersionTag) {
|
async function createTagDocListPage(tag: VersionTag) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue