diff --git a/lib/hexo/post.js b/lib/hexo/post.js index b91cbea111..a4ccdfe6af 100644 --- a/lib/hexo/post.js +++ b/lib/hexo/post.js @@ -233,6 +233,10 @@ class Post { data.slug = slugize((data.slug || data.title).toString(), { transform: config.filename_case }); data.layout = (data.layout || config.default_layout).toLowerCase(); data.date = data.date ? moment(data.date) : moment(); + // Whether to allow async/concurrent rendering of tags within the post. + // Enabling it can improve performance for slow async tags, but may produce + // wrong results if tags within a post depend on each other. + data.async_tags = data.async_tags || false; return Promise.all([ // Get the post path @@ -413,6 +417,9 @@ class Post { // If rendering is disabled, do nothing. return cacheObj.restoreAllSwigTags(content); } + if (!data.async_tags) { + return tag.render(cacheObj.restoreAllSwigTags(content), data); + } // We'd like to render tags concurrently, so we split `content` // by top-level HTML nodes that have swig tags into `split_content` array // (nodes that don't have swig tags don't need to be split).