1 | # hexo-generator-index
|
2 |
|
3 | [![Build Status](https://travis-ci.org/hexojs/hexo-generator-index.svg?branch=master)](https://travis-ci.org/hexojs/hexo-generator-index)
|
4 | [![NPM version](https://badge.fury.io/js/hexo-generator-index.svg)](https://www.npmjs.com/package/hexo-generator-index)
|
5 | [![Coverage Status](https://img.shields.io/coveralls/hexojs/hexo-generator-index.svg)](https://coveralls.io/r/hexojs/hexo-generator-index?branch=master)
|
6 |
|
7 | Index generator for [Hexo].
|
8 |
|
9 | It generates an archive of posts on your homepage, according to the `index` or `archive` layout of your theme.
|
10 |
|
11 | ## Installation
|
12 |
|
13 | ``` bash
|
14 | $ npm install hexo-generator-index --save
|
15 | ```
|
16 |
|
17 | ## Options
|
18 |
|
19 | Add or modify the following section to your root _config.yml file
|
20 |
|
21 | ``` yaml
|
22 | index_generator:
|
23 | path: ''
|
24 | per_page: 10
|
25 | order_by: -date
|
26 | pagination_dir: page
|
27 | ```
|
28 |
|
29 | - **path**: Root path for your blog's index page.
|
30 | - default: ""
|
31 | - **per_page**: Posts displayed per page.
|
32 | - default: [`config.per_page`](https://hexo.io/docs/configuration.html#Pagination) as specified in the official Hexo docs (if present), otherwise `10`
|
33 | - `0` disables pagination
|
34 | - **order_by**: Posts order.
|
35 | - default: date descending
|
36 | - **pagination_dir**: URL format.
|
37 | - default: 'page'
|
38 | - `awesome-page` makes the URL ends with 'awesome-page/<page number>' for second page and beyond.
|
39 |
|
40 | ## Usage
|
41 |
|
42 | The `sticky` parameter in the post [Front-matter](https://hexo.io/docs/front-matter) will be used to pin the post to the top of the index page. Higher `sticky` means that it will be ranked first.
|
43 |
|
44 | ```yml
|
45 | ---
|
46 | title: Hello World
|
47 | date: 2013/7/13 20:46:25
|
48 | sticky: 100
|
49 | ---
|
50 | ```
|
51 |
|
52 | ## Note
|
53 |
|
54 | If your theme define a non-archive `index` layout (e.g. About Me page), this plugin would follow that layout instead and not generate an archive. In that case, use [hexo-generator-archive](https://github.com/hexojs/hexo-generator-archive) to generate an archive according to the `archive` layout.
|
55 |
|
56 | ## License
|
57 |
|
58 | MIT
|
59 |
|
60 | [Hexo]: http://hexo.io/
|