Open lxiiang opened 11 months ago
I dynamically set the permalink of each md in extendPageData method. The corresponding folder is not generated after packaging in Linux environment, but it is OK in windows environment
mycode extendPageData($page) { const { _filePath, regularPath path, } = $page; if (!$page.frontmatter.permalink) { const pathList = String(_filePath).split("\"); const length = pathList.length; const folderName = pathList[length - 2] || ""; let fileName = pathList[length - 1].split(".")[0]; fileName = fileName.indexOf("-") >= 0 ? fileName.split("-")[1] : fileName; const title = ${folderName}/${fileName}; let englishTitle = getEnglishName(title); // 生成 permalink $page.frontmatter.permalink = /${englishTitle}; $page.frontmatter.sidebarDepth = 0; $page.title = fileName; } },
${folderName}/${fileName}
/${englishTitle}
I dynamically set the permalink of each md in extendPageData method. The corresponding folder is not generated after packaging in Linux environment, but it is OK in windows environment
mycode extendPageData($page) { const { _filePath, regularPath path, } = $page; if (!$page.frontmatter.permalink) { const pathList = String(_filePath).split("\"); const length = pathList.length; const folderName = pathList[length - 2] || ""; let fileName = pathList[length - 1].split(".")[0]; fileName = fileName.indexOf("-") >= 0 ? fileName.split("-")[1] : fileName; const title =
${folderName}/${fileName}
; let englishTitle = getEnglishName(title); // 生成 permalink $page.frontmatter.permalink =/${englishTitle}
; $page.frontmatter.sidebarDepth = 0; $page.title = fileName; } },