This commit is contained in:
Evan Simkowitz
2024-10-08 16:54:19 -04:00
parent ba715f6241
commit a0acc8a835
+1 -5
View File
@@ -50,10 +50,6 @@ class DocsPlugin {
const bar = progress.defaultBar();
bar.start(this.docs.length, 0, { prefix: 'rendering images', suffix: '-' });
for (const doc of this.docs) {
console.log("doc", doc);
if (doc.metadata.permalink === "/") {
doc.metadata.permalink = "/index";
}
const document = new document_1.Document(this.getHtmlPath(doc));
bar.update({ suffix: doc.metadata.permalink });
await document.load();
@@ -76,7 +72,7 @@ class DocsPlugin {
logger_1.default.success('Generated og images for docs pages');
};
getHtmlPath = (doc) => doc.metadata?.permalink &&
path.join(this.stripLangFromPath(this.context.outDir), `${doc.metadata.permalink}.html`);
path.join(this.stripLangFromPath(this.context.outDir), `${doc.metadata.permalink}${doc.metadata.permalink.endsWith("/") ? "index" : ""}.html`);
stripLangFromPath = (path) => {
const lang = this.context.i18n.locales.find((locale) => path.endsWith(`/${locale}`));
return lang ? path.slice(0, -lang.length - 1) : path;