From 140cbcbcfdcd6d8295e3cc7df544fc5b2a4a39c3 Mon Sep 17 00:00:00 2001 From: uiolee <22849383+uiolee@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:35:24 +0800 Subject: [PATCH] update README --- README.md | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index c6e6817..fb3bac8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Pagination utilities for [Hexo] generator plugins. ## Installation -``` bash +```bash $ npm install hexo-pagination --save ``` @@ -16,41 +16,42 @@ $ npm install hexo-pagination --save ### pagination(base, posts, [options]) -Option | Description | Default ---- | --- | --- -`perPage` | Posts displayed per page | 10 -`format` | URL format | page/%d/ -`layout` | Layout. This value can be a string or an array. | ['archive', 'index'] -`data` | Extra data | +| Option | Description | Default | +| ---------------- | ----------------------------------------------- | ---------------------- | +| `perPage` | Posts displayed per page | `10` | +| `format` | URL format | `page/%d/` | +| `layout` | Layout. This value can be a string or an array. | `['archive', 'index']` | +| `data` | Extra data | `{}` | +| `explicitPaging` | Number the first page. e.g. `page/1/index.html` | `false` | For example: -``` js -var pagination = require('hexo-pagination'); +```js +var pagination = require("hexo-pagination"); -pagination('/tags/hexo', [], { +pagination("/tags/hexo", [], { perPage: 10, - format: 'page/%d/', - layout: ['archive', 'index'], + format: "page/%d/", + layout: ["archive", "index"], data: { - tag: 'hexo' - } + tag: "hexo", + }, }); ``` This function returns an array containing objects with 3 properties: `path`, `layout`, `data`. -Data | Description ---- | --- -`base` | Base URL -`total` | Total pages -`current` | Current page number -`current_url` | Path of the current page (which equals to `path`) -`posts` | The slice of posts for the current page -`prev` | Previous page number -`prev_link` | The path to the previous page -`next` | Next page number -`next_link` | The path to the next page +| Data | Description | +| ------------- | ------------------------------------------------- | +| `base` | Base URL | +| `total` | Total pages | +| `current` | Current page number | +| `current_url` | Path of the current page (which equals to `path`) | +| `posts` | The slice of posts for the current page | +| `prev` | Previous page number | +| `prev_link` | The path to the previous page | +| `next` | Next page number | +| `next_link` | The path to the next page | ## License