mirror of
https://github.com/wavetermdev/docusaurus-og.git
synced 2026-08-05 13:46:35 -07:00
build
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user