How to get current post inside hexo.extend.helper.register
callback ?
#5224
Answered
by
dimaslanjaka
dimaslanjaka
asked this question in
Question / Answer
-
I need get current post title in helper typescript function. how to do that? hexo.extend.helper.register(
'list_related_posts',
function (
this: import('hexo'),
options: {
maxCount: number;
/** 'date' | 'updated' */
orderBy: string;
isAscending?: any;
}
) {
/// how ?
}
); |
Beta Was this translation helpful? Give feedback.
Answered by
dimaslanjaka
Jun 5, 2023
Replies: 2 comments
-
solved by dump 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);
}
); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dimaslanjaka
-
can you add label |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
solved by dump
this
keys (Object.keys(this)
)