feat(content-docs): allow explicitly disabling index page for generated category (#6452)

* feat(content-docs): allow explicitly disabling index page for generated category

* docs

* add test
This commit is contained in:
Joshua Chen 2022-01-27 23:14:07 +08:00 committed by GitHub
parent ffa108b58b
commit 3c58d7f027
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 57 additions and 3 deletions

View file

@ -45,7 +45,7 @@ export type CategoryMetadataFile = {
collapsed?: boolean;
collapsible?: boolean;
className?: string;
link?: SidebarItemCategoryLinkConfig;
link?: SidebarItemCategoryLinkConfig | null;
// TODO should we allow "items" here? how would this work? would an "autogenerated" type be allowed?
// This mkdocs plugin do something like that: https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/
@ -222,8 +222,8 @@ export const DefaultSidebarItemsGenerator: SidebarItemsGenerator = async ({
function getCategoryLinkedDocId(): string | undefined {
const link = categoryMetadata?.link;
if (link) {
if (link.type === 'doc') {
if (link !== undefined) {
if (link && link.type === 'doc') {
return findDocByLocalId(link.id)?.id || getDoc(link.id).id;
} else {
// We don't continue for other link types on purpose!