Skip to content

Commit

Permalink
fix: Removed index slug
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed May 10, 2022
1 parent f873b32 commit 3667eb5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
15 changes: 2 additions & 13 deletions packages/docusaurus-plugin-typedoc/src/theme.ts
Expand Up @@ -109,12 +109,11 @@ export class DocusaurusTheme extends MarkdownTheme {
id: pageId,
title: pageTitle,
};
if (page.url === this.entryDocument) {
items = { ...items, slug: this.getSlug() };
if (page.url === this.entryDocument && this.indexSlug) {
items = { ...items, slug: this.indexSlug };
}

if (this.sidebar.autoConfiguration) {
console.log('config', this.sidebar.autoConfiguration);
if (sidebarLabel && sidebarLabel !== pageTitle) {
items = { ...items, sidebar_label: sidebarLabel as string };
}
Expand Down Expand Up @@ -178,16 +177,6 @@ export class DocusaurusTheme extends MarkdownTheme {
return getPageTitle(page);
}

getSlug() {
if (this.indexSlug) {
return this.indexSlug;
}
if (this.out === process.cwd()) {
return '/';
}
return `/${path.relative(process.cwd(), this.out).replace(/\\/g, '/')}/`;
}

get mappings() {
return super.mappings.map((mapping) => {
if (mapping.kind.includes(ReflectionKind.Namespace)) {
Expand Down
Expand Up @@ -2,6 +2,7 @@

exports[`Options: should merge custom sidebar options 1`] = `
Object {
"autoConfiguration": true,
"categoryLabel": "API",
"fullNames": true,
"indexLabel": "Custom index",
Expand Down Expand Up @@ -37,6 +38,7 @@ Object {
"none",
],
"sidebar": Object {
"autoConfiguration": true,
"categoryLabel": "API",
"fullNames": false,
"indexLabel": undefined,
Expand Down
Expand Up @@ -21,7 +21,6 @@ exports[`Plugin: (docs) should write doc 1`] = `
"---
id: \\"index\\"
title: \\"typedoc-plugin-markdown\\"
slug: \\"/api/\\"
sidebar_label: \\"Readme\\"
sidebar_position: 0
custom_edit_url: null
Expand Down

0 comments on commit 3667eb5

Please sign in to comment.