Skip to content

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

Open
@lxiiang

Description

@lxiiang

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions