diff --git a/docs/pagination/README.md b/docs/pagination/README.md index e87ae96..d596ab8 100644 --- a/docs/pagination/README.md +++ b/docs/pagination/README.md @@ -69,12 +69,12 @@ A function to get the title of pagination page dynamically: ```js // directories function getPaginationPageTitle (index, id) { - return `Page ${index + 1} | ${id}` + return `Page ${index + 2} | ${id}` } // frontmatters function getPaginationPageTitle (index, id, scope) { - return `Page ${index + 1} - ${id} | ${scope}` + return `Page ${index + 2} - ${id} | ${scope}` } ``` @@ -83,4 +83,9 @@ There are three args to help you customize your title: - `id` is the id in the [config](../config/#id). - `scope` is the [key](../config/#keys) while configuring frontmatters or same as `id` while configuring directories. +::: tip TIP +`${index + 2}`: why `+2`? +Plus 1 since index starts at 0.
+Plus another 1 since the index page won't show page number. +::: diff --git a/src/node/handleOptions.ts b/src/node/handleOptions.ts index 3589044..e8fb1f3 100644 --- a/src/node/handleOptions.ts +++ b/src/node/handleOptions.ts @@ -109,7 +109,7 @@ export function handleOptions( paginations.push({ classifierType: ClassifierTypeEnum.Directory, getPaginationPageTitle(index, id) { - return `Page ${index + 1} | ${id}` + return `Page ${index + 2} | ${id}` }, ...resolvePaginationConfig( ClassifierTypeEnum.Directory, diff --git a/src/node/index.ts b/src/node/index.ts index f9eeeb4..0770bb3 100644 --- a/src/node/index.ts +++ b/src/node/index.ts @@ -136,7 +136,7 @@ module.exports = (options: BlogPluginOptions, ctx: VuePressContext) => { paginations.push({ classifierType: ClassifierTypeEnum.Frontmatter, getPaginationPageTitle(index, id, scope) { - return `Page ${index + 1} - ${id} | ${scope}` + return `Page ${index + 2} - ${id} | ${scope}` }, ...resolvePaginationConfig( ClassifierTypeEnum.Frontmatter,