You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
yqs112358
changed the title
The behavior of post_permalink filter is strange, should be mentioned in the docs.
The behavior of post_permalink filter is strange
Nov 21, 2024
Check List
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 thepermalink
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 adata
object as its first argument, with no permalink set . But it will get apermalink
string instead ofdata
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
andafter-permalink
hook positions explicitly.Others
No response
The text was updated successfully, but these errors were encountered: