Skip to content

Commit

Permalink
add a way to disable tag encryption
Browse files Browse the repository at this point in the history
  • Loading branch information
D0n9X1n committed Jul 18, 2020
1 parent ed01353 commit 52113e0
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
18 changes: 18 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,24 @@ encrypt: # hexo-blog-encrypt

```

#### To disable tag encryption

Just let the `password` property in front matter to `""`.

Example:

```
---
title: Callback Test
date: 2019-12-21 11:54:07
tags:
- A Tag should be encrypted
password: ""
---
Use a "" to diable tag encryption.
```

### Config priority

post's front matter > `_config.yml` (in the root directory) > default
Expand Down
18 changes: 18 additions & 0 deletions ReadMe.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,24 @@ encrypt: # hexo-blog-encrypt

```

#### 对博文禁用 Tag 加密

只需要将博文头部的 `password` 设置为 `""` 即可取消 Tag 加密.

Example:

```
---
title: Callback Test
date: 2019-12-21 11:54:07
tags:
- A Tag should be encrypted
password: ""
---
Use a "" to diable tag encryption.
```

### 配置优先级

文章信息头 > `_config.yml` (站点根目录下的) > 默认配置
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ hexo.extend.filter.register('after_post_render', (data) => {
let password = data.password;
let tagUsed = false;

// use a empty password to disable category encryption
if (password === "") {
return data;
}

if (hexo.config.encrypt === undefined) {
hexo.config.encrypt = [];
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint --ext .js ./"
},
"version": "3.0.12",
"version": "3.0.13",
"devDependencies": {
"eslint": "^6.2.2"
}
Expand Down

0 comments on commit 52113e0

Please sign in to comment.