Skip to content

Commit 7ab6f05

Browse files
committed
add a per-post option
1 parent 2720e39 commit 7ab6f05

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/hexo/post.js

+7
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ class Post {
233233
data.slug = slugize((data.slug || data.title).toString(), { transform: config.filename_case });
234234
data.layout = (data.layout || config.default_layout).toLowerCase();
235235
data.date = data.date ? moment(data.date) : moment();
236+
// Whether to allow async/concurrent rendering of tags within the post.
237+
// Enabling it can improve performance for slow async tags, but may produce
238+
// wrong results if tags within a post depend on each other.
239+
data.async_tags = data.async_tags || false;
236240

237241
return Promise.all([
238242
// Get the post path
@@ -413,6 +417,9 @@ class Post {
413417
// If rendering is disabled, do nothing.
414418
return cacheObj.restoreAllSwigTags(content);
415419
}
420+
if (!data.async_tags) {
421+
return tag.render(cacheObj.restoreAllSwigTags(content), data);
422+
}
416423
// We'd like to render tags concurrently, so we split `content`
417424
// by top-level HTML nodes that have swig tags into `split_content` array
418425
// (nodes that don't have swig tags don't need to be split).

0 commit comments

Comments
 (0)