Open andrewmoscardino-awh opened 3 weeks ago
I should also note that these behave the same:
hexo.extend.filter.register('before_post_render', function (post) {
post.has_code_block = post.raw.includes('```');
return post;
});
hexo.extend.filter.register('before_post_render', function (post) {
return {
...post,
has_code_block: post.raw.includes('```')
};
});
Ok, after some more tinkering, I've found that this works:
hexo.extend.filter.register('before_post_render', function (post) {
post["has_code_block"] = post.raw.includes('```');
return post;
});
That's very strange.
Check List
hexo version
to check)Expected behavior
I have a filter on
before_post_render
. Previously with Hexo 6.x, I was able to add a property to the post like so:And then the new property,
has_code_block
in this case, would be usable in my templates. With Hexo 7, the new property isn't available in the templates. Modifying an existing property works as expected, though.Actual behavior
The new property is not available within templates. Updated properties are available in templates with their updated values.
How to reproduce?
post
object.Is the problem still there under
Safe mode
?n/a
Your Node.js & npm version
Your Hexo and Plugin version
Your
package.json
Your site's
_config.yml
(Optional)No response
Others
No response