# Pagination Config

TIP

We strongly recommend that you read the Getting Started section before using this plugin.

# sorter

  • Type: function
  • Default: See Below

Sorter for matched pages, the default sorter is as follows:

function sorter(prev: VuePressPage, next: VuePressPage){
  const prevTime = new Date(prev.frontmatter.date).getTime()
  const nextTime = new Date(next.frontmatter.date).getTime()
  return prevTime - nextTime > 0 ? -1 : 1
},

The function will be a parameter of Array.sort().

# lengthPerPage

  • Type: number
  • Default: 10

Maximum number of posts per page.

# layout

  • Type: string
  • Default: DirectoryPagination || Layout

Layout for pagination page (Except the index page.)

# getPaginationPageUrl

  • Type: function
  • Default: See Below

A function to get the url of pagination page dynamically:

function getPaginationPageUrl(index) {
  if (index === 0) {
    return indexPath
  }
  return `${indexPath}page/${index + 1}/`
}

# getPaginationPageTitle

  • Type: function
  • Default: See Below

A function to get the title of pagination page dynamically:

// directories
function getPaginationPageTitle (index, id) {
  return `Page ${index + 1} | ${id}`
}

// frontmatters
function getPaginationPageTitle (index, id, scope) {
  return `Page ${index + 1} - ${id} | ${scope}`
}

There are three args to help you customize your title:

  • index is the index of pages.
  • id is the id in the config.
  • scope is the key while configuring frontmatters or same as id while configuring directories.