Skip to content
A Hexo plugin that automatically corrects tag names.
JavaScript
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.eslintrc.json Inital commit Nov 28, 2019
.gitignore Inital commit Nov 28, 2019
.npmrc Inital commit Nov 28, 2019
.travis.yml Inital commit Nov 28, 2019
LICENSE Inital commit Nov 28, 2019
README.md update readme Dec 2, 2019
index.js udpate deps. eslint-config-hexo@4.0.0 Dec 2, 2019
mocha.opts Inital commit Nov 28, 2019
package.json udpate deps. eslint-config-hexo@4.0.0 Dec 2, 2019
test.js Inital commit Nov 28, 2019

README.md

hexo-easy-tags-plugin

NPM Version LICENSE Build Status dependencies Status devDependencies Status

A Hexo plugin that automatically corrects tag names.

Why Use This?

We can't remember the case of each tag name used previously. Foo? foo? or FOO?

If you use both Foo and foo, you will have problems.

  • Issue 1: Since the case-insensitive file system can't create both /Foo/ and /foo/ directories, one of them will not accessible.
  • Issue 2: If set filename_case: 1 option on the _config.yml, both have slugs as /foo/, but Foo and foo are different tags so only one is created under /foo/.

Solution of This Plugin

This plugin detects before used name and automatically corrects others.

For example:

post-A.md

tags:
  - Java
  - foo-bar

post-B.md

tags:
  - java
  - foo_bar

post-C.md

tags:
  - JAVA
  - foo bar

All of the above will be automatically change to

tags:
  - Java
  - foo-bar

slugs: /Java/, /foo-bar/

NOTE:
Depending on the order of processing posts, the tag name can be java, Java or JAVA.

Tags (before)

JAVA(1), Java(1), foo-bar(1), foo_bar(1), foo bar(1), java(1)

Tags (after)

Java(3), foo-bar(3)

Installation

npm install hexo-easy-tags-plugin

Usages

Just install ths plugin, and run hexo clean && hexo g.

Options

You can add options to the _config.yml file.

# _config.yml

easy_tags_plugin:
  enable: true
  tag_name_case: 1
  • enable (default: true) - enable this plugin, or disable it.
  • tag_name_case (default: 0) - option to transform all tags name to lowercase of uppercase. 0 no transform, 1 lowercase, 2 uppercase.

TODO

  • Transform tag slugs to lowercase by default.
    Suggest set filename_case: 1 in _config.yml.
  • Handle tag_map configuration.
  • Sort tags by name, not case sensitive.
  • Transform tag slugs using transliteration module.

License

Copyright (c) 2019 dailyrandomphoto. Licensed under the MIT license.

You can’t perform that action at this time.