mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-14 00:32:47 +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
|
@ -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
Add a link
Reference in a new issue