Skip to content

Commit ba715f6

Browse files
committed
better index handling
1 parent 9418222 commit ba715f6

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

src/server/docs.plugin.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ export class DocsPlugin {
6868
const bar = progress.defaultBar()
6969
bar.start(this.docs.length, 0, {prefix: 'rendering images', suffix: '-'})
7070
for (const doc of this.docs) {
71-
if (doc.metadata.permalink === "/") {
72-
doc.metadata.permalink = "/index"
73-
}
7471
const document = new Document(this.getHtmlPath(doc)!)
7572
bar.update({ suffix: doc.metadata.permalink })
7673

@@ -103,7 +100,7 @@ export class DocsPlugin {
103100

104101
getHtmlPath = (doc: Partial<DocsPageData>) =>
105102
doc.metadata?.permalink &&
106-
path.join(this.stripLangFromPath(this.context.outDir), `${doc.metadata.permalink}.html`)
103+
path.join(this.stripLangFromPath(this.context.outDir), `${doc.metadata.permalink}${doc.metadata.permalink.endsWith("/") ? "index" : ""}.html`)
107104
stripLangFromPath = (path: string) => {
108105
const lang = this.context.i18n.locales.find((locale) => path.endsWith(`/${locale}`))
109106
return lang ? path.slice(0, -lang.length - 1) : path

0 commit comments

Comments
 (0)