https://github.com/hexojs/hexo-generator-index
Index generator plugin for Hexo.
https://github.com/hexojs/hexo-generator-index
hexo hexo-plugin
Last synced: 6 months ago
JSON representation
Index generator plugin for Hexo.
- Host: GitHub
- URL: https://github.com/hexojs/hexo-generator-index
- Owner: hexojs
- License: mit
- Created: 2014-12-29T10:44:32.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2025-05-05T20:30:25.000Z (8 months ago)
- Last Synced: 2025-06-08T22:09:10.889Z (7 months ago)
- Topics: hexo, hexo-plugin
- Language: JavaScript
- Homepage:
- Size: 79.1 KB
- Stars: 53
- Watchers: 14
- Forks: 44
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hexo-generator-index
[](https://github.com/hexojs/hexo-generator-index/actions?query=workflow%3ATester)
[](https://www.npmjs.com/package/hexo-generator-index)
[](https://coveralls.io/r/hexojs/hexo-generator-index?branch=master)
Index generator for [Hexo].
It generates an archive of posts on your homepage, according to the `index` or `archive` layout of your theme.
## Installation
```bash
npm install hexo-generator-index --save
```
## Options
Add or modify the following section to your root `_config.yml` file.
```yaml
index_generator:
path: ""
per_page: 10
order_by: -date
pagination_dir: page
layout: ["index", "archive"]
```
- **path**: Root path for your blog's index page.
- default: `""`
- **per_page**: Posts displayed per page.
- default: [`config.per_page`](https://hexo.io/docs/configuration.html#Pagination) as specified in the official Hexo docs (if present), otherwise `10`
- `0` disables pagination.
- **order_by**: Posts order.
- default: `-date` (date descending)
- **pagination_dir**: URL format.
- default: `page`
- e.g. set `awesome-page` makes the URL ends with `awesome-page/` for second page and beyond.
- **layout**: custom layout.
- defalut: `["index", "archive"]`
## Usage
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.
```yml
---
title: Hello World
date: 2013/7/13 20:46:25
sticky: 100
---
```
The `hidden` parameter can be used to hide a post from the index page. When `hidden: true` is set, the post will not appear in the index but will still be accessible in other ways (e.g., the archive page or via a direct link).
```yml
---
title: Secret Post
date: 2024/11/11 11:11:11
hidden: true
---
```
## Note
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.
## License
MIT
[Hexo]: https://hexo.io/