A Hexo plugin that automatically corrects tag names.
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: 1option on the_config.yml, both have slugs as/foo/, butFooandfooare different tags so only one is created under/foo/.
This plugin detects before used name and automatically corrects others.
For example:
post-A.md
tags:
- Java
- foo-barpost-B.md
tags:
- java
- foo_barpost-C.md
tags:
- JAVA
- foo barAll of the above will be automatically change to
tags:
- Java
- foo-barslugs: /Java/, /foo-bar/
NOTE:
Depending on the order of processing posts, the tag name can bejava,JavaorJAVA.
❌ Tags (before)
JAVA(1), Java(1), foo-bar(1), foo_bar(1), foo bar(1), java(1)
✅ Tags (after)
Java(3), foo-bar(3)
npm install hexo-easy-tags-pluginJust install ths plugin, and run hexo clean && hexo g.
You can add options to the _config.yml file.
# _config.yml
easy_tags_plugin:
enable: true
tag_name_case: 1
sort_ignore_case: trueenable(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.sort_ignore_case(default: true) - if set tofalse, the order of the tags is case sensitive. Affectslist_tags(),tagcloud()helpers.action(default:correct) - if set toreport, print conflicted tags and exit.
- Add
sort_ignore_caseoption to enable case-insensitive sort tags.
- Add
actionoption to enable reporting conflicts instead of automatic corrections (#3) - Handle
tag_mapconfiguration.
- Transform tag slugs to lowercase by default.
Suggest setfilename_case: 1in_config.yml. - Transform tag slugs using transliteration module.
Copyright (c) 2019 dailyrandomphoto. Licensed under the MIT license.