diff --git a/examples/frontmatter-classifier/.vuepress/config.js b/examples/frontmatter-classifier/.vuepress/config.js index 0003a98..10d10c8 100644 --- a/examples/frontmatter-classifier/.vuepress/config.js +++ b/examples/frontmatter-classifier/.vuepress/config.js @@ -12,6 +12,7 @@ module.exports = { path: '/tag/', // Layout of the `entry page` layout: 'Tags', + scopeLayout: 'FrontmatterClassifier', }, ], }], diff --git a/src/node/handleOptions.ts b/src/node/handleOptions.ts index e8fb1f3..ac5df54 100644 --- a/src/node/handleOptions.ts +++ b/src/node/handleOptions.ts @@ -163,7 +163,7 @@ export function handleOptions( keys, map, scopeLayout, - _handler: curryFrontmatterHandler(id, map), + _handler: curryFrontmatterHandler(id, map, indexPath), }) } diff --git a/src/node/index.ts b/src/node/index.ts index 0770bb3..5bf5538 100644 --- a/src/node/index.ts +++ b/src/node/index.ts @@ -131,8 +131,6 @@ module.exports = (options: BlogPluginOptions, ctx: VuePressContext) => { /** * Register pagination */ - const indexPath = `/${scope}/${key}/` - paginations.push({ classifierType: ClassifierTypeEnum.Frontmatter, getPaginationPageTitle(index, id, scope) { @@ -142,7 +140,7 @@ module.exports = (options: BlogPluginOptions, ctx: VuePressContext) => { ClassifierTypeEnum.Frontmatter, options.globalPagination, pagination, - indexPath, + path, ctx, keys, ), diff --git a/src/node/util.ts b/src/node/util.ts index dca932b..297e589 100644 --- a/src/node/util.ts +++ b/src/node/util.ts @@ -14,15 +14,16 @@ export interface FrontmatterTempMap { export function curryFrontmatterHandler( scope: string, map: FrontmatterTempMap, + path: string, ): FrontmatterHandler -export function curryFrontmatterHandler(scope, map) { +export function curryFrontmatterHandler(scope, map, path) { return (key, pageKey) => { if (key) { if (!map[key]) { map[key] = {} map[key].key = key map[key].scope = scope - map[key].path = `/${scope}/${key}/` + map[key].path = `${path}${key}/` map[key].pageKeys = [] } map[key].pageKeys.push(pageKey)