hexojs / hexojs/hexo

The behavior of `post_permalink` filter is strange

Open
#5,575 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
41.8k
Forks
41
PR merge metrics
No merged PRs in 30d

Description

### Check List

- [X] I have already read [Docs page](https://hexo.io/docs/).
- [X] I have already searched existing issues.

### Feature Request

According to builtin plugin https://github.com/hexojs/hexo/blob/master/lib/plugins/filter/post_permalink.ts, it's a plugin that inputs `data` object but returns the `permalink` string, and its priority is 10 in default.

So, when developing a plugin that registered on `post_permalink`, if the priority of filter is between 1-10, it will get a `data` object as its first argument, with no permalink set . But it will get a `permalink` string instead of `data` object when the filter's priority is larger than 10.

This design can sometimes be disturbing: different priority value can lead to different parameter contents. I think it's better to make this clear in the documentation. Or, better yet, redesign this API to separate `post-permalink` and `after-permalink` hook positions explicitly.

### Others

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.