vuepress icon indicating copy to clipboard operation
vuepress copied to clipboard

When permalink is used in md, the corresponding folder is not generated in Linux environment packaging

Open lxiiang opened this issue 1 year ago • 0 comments

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; } },

lxiiang avatar Jan 02 '24 09:01 lxiiang