Skip to content

How to get current post inside hexo.extend.helper.register callback ? #5224

Discussion options

You must be logged in to vote

solved by dump this keys (Object.keys(this))

hexo.extend.helper.register(
    'list_related_posts',
    function (
      this: import('hexo'),
      options: {
        maxCount: number;
        /** 'date' | 'updated' */
        orderBy: string;
        isAscending?: any;
      }
    ) {
   const page = this.page;
   console.log('title', page.title);
   }
);

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dimaslanjaka
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant