1.0.1 • Published 2 years ago

hexo-generator-index-custom v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

hexo-generator-index-custom

npm

中文文档

Custom Index generator for Hexo.

It generates an archive of posts on your homepage, according to the index or archive layout of your theme.

Difference

  • pin top

both the sticky and top parameters in the post Front-matter can be used to pin the post to the top of the index page.

because of in the old version, hexo-generator-index cannot pin the post to the top of the index page

many people use hexo-generator-index-pin-top to do this

  • hide posts

use hide: true in in the post Front-matter to hide the post from the index page

Installation

$ npm uninstall hexo-generator-index

$ npm install hexo-generator-index-custom --save

Options

Add or modify the following section to your root _config.yml file

index_generator:
  path: ''
  per_page: 10
  order_by: -date
  pagination_dir: page
  • path: Root path for your blog's index page.
    • default: ""
  • per_page: Posts displayed per page.
    • default: config.per_page as specified in the official Hexo docs (if present), otherwise 10
    • 0 disables pagination
  • order_by: Posts order.
    • default: date descending
  • pagination_dir: URL format.
    • default: 'page'
    • awesome-page makes the URL ends with 'awesome-page/' for second page and beyond.

Usage

The sticky or top parameter in the post Front-matter will be used to pin the post to the top of the index page. Higher sticky (or top) means that it will be ranked first.

You can also use sticky: true or top: true to pin the post to the top of the index page.

---
title: Hello World
date: 2013/7/13 20:46:25
sticky: 100
---
---
title: Hello World
date: 2013/7/13 20:46:25
top: 100
---

The hide parameter in the post Front-matter will be used to hide the post from the index page.

---
title: Hello World
date: 2013/7/13 20:46:25
hide: 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 to generate an archive according to the archive layout.

License

MIT

hexojs/Hexo

hexojs/hexo-generator-index