From 17f84f6e462ef433a64c5a3a5974a67bb7a61f68 Mon Sep 17 00:00:00 2001 From: coolyang <504575307@qq.com> Date: Sat, 9 Mar 2019 05:47:44 +0800 Subject: [PATCH] fix: fix blog plugin path bug --- packages/@vuepress/plugin-blog/index.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/@vuepress/plugin-blog/index.js b/packages/@vuepress/plugin-blog/index.js index 697c33fc82..c2c8b453fd 100644 --- a/packages/@vuepress/plugin-blog/index.js +++ b/packages/@vuepress/plugin-blog/index.js @@ -20,7 +20,7 @@ module.exports = (options, ctx) => { frontmatter: { layout: getLayout('Categories', 'Page') } }, { - when: ({ regularPath }) => regularPath.startsWith('/category/'), + when: ({ regularPath }) => regularPath.startsWith(categoryIndexPageUrl), frontmatter: { layout: getLayout('Category', 'Page') } }, { @@ -28,7 +28,7 @@ module.exports = (options, ctx) => { frontmatter: { layout: getLayout('Tags', 'Page') } }, { - when: ({ regularPath }) => regularPath.startsWith('/tag/'), + when: ({ regularPath }) => regularPath.startsWith(tagIndexPageUrl), frontmatter: { layout: getLayout('Tag', 'Page') } }, { @@ -86,15 +86,14 @@ module.exports = (options, ctx) => { if (key) { if (!map[key]) { map[key] = {} - map[key].path = `/${scope}/${key}.html` + map[key].path = `${scope}${key}.html` map[key].pageKeys = [] } map[key].pageKeys.push(pageKey) } } - - const handleTag = curryHandler('tag', tagMap) - const handleCategory = curryHandler('category', categoryMap) + const handleTag = curryHandler(tagIndexPageUrl, tagMap) + const handleCategory = curryHandler(categoryIndexPageUrl, categoryMap) pages.forEach(({ key,