From 5c0e62f08b649c6b65ae94734e3c7678fe329b6b Mon Sep 17 00:00:00 2001 From: Coolyang <504575307@qq.com> Date: Wed, 13 Mar 2019 02:12:33 +0800 Subject: [PATCH] fix($plugin-blog): inconsistent paths of tag and category pages with index page (#1420) --- 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,