Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lxiiang opened this issue Jan 2, 2024 · 0 comments

Comments

@lxiiang
Copy link

lxiiang commented Jan 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant