npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hexo-generator-plus

v0.2.3

Published

A package that generates index, archive, categories and tags pages for Hexo

Downloads

2

Readme

hexo-generator-plus

中文文档

A package that generates index, archive, categories and tags pages for Hexo. It supports i18n and index pages for categories and tags.

Installation

$ npm uninstall hexo-generator-index hexo-generator-archive hexo-generator-category hexo-generator-tag
$ npm install hexo-generator-plus --save

Usage

If your site contains only one language, there's no additional actions required. This package will generate files as normal.

i18n

Please follow these steps for internationalization

  1. Create a new folder for each language, and put all posts and pages in the corresponding folder. For example:
sources/
  en/
    post1.md
    post2.md
  zh/
    post3.md
    post4.md
  1. Add the following to _config.yml:
generator_plus:
  language: ['first language', 'second language']
  1. Change new_post_name variable in _config.yml to new_post_name: :lang/:title.md
  2. Change permalink variable in _config.yml permalink: :lang/{what was here before}

Helpers

url_for_lang() returns a proper i18n url. You should only use this for categories and tags, but not for posts.

get_posts() returns all posts written in current language.

get_categories() returns all categories that contain at least a post in current language.

get_tags() returns all tags that contain at least one post in current language.

Note: The current language refers to the language of the page from which the function is called

Options

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

generator_plus:
  language: 'default'
  pagination_dir: 'page'
  generator: ["index", "archive", "category", "tag"]

  index_generator:
    per_page: 10
    order_by: -date

  archive_generator:
    per_page: 10
    order_by: -date

  category_generator:
    per_page: 10
    order_by: -date
    enable_index_page: false

  tag_generator:
    per_page: 10
    order_by: -date
    enable_index_page: false

Overall Options:

  • language: Languages in site
    • default: language in original config, if not defined then default.
  • pagination_dir: Pagination dir
    • default: pagination_dir in original config, if not defined then page.
  • generator: Generators wanted
    • default: ["index", "archive", "category", "tag"]

For all generators:

  • per_page: Posts displayed per page.
    • default: per_page in original config, then 10.
    • 0 disables pagination
  • order_by: Posts order.
    • default: date descending

For category_generator and tag_generator only:

  • enable_index_page: Whether to generate the index page.
    • default: false

Layout:

Layout files are not configurable, but here are the orders of layout files used:

  • Index: index.ejs
  • Archive: archive.ejs, index.ejs
  • Category: categories.ejs, index.ejs
  • Category (index page): categories-index.ejs, 'categories.ejs, index.ejs
  • Tag: tags, index.ejs
  • Tag (index page): tags-index, tags.ejs, index.ejs

Note

For how to incooperate this plugin into a site, please visit hexo-theme-world.