Skip to content

perf: skip tag render when there is no swigTags#5650

Merged
stevenjoezhang merged 4 commits intohexojs:masterfrom
D-Sketon:perf/tag
Apr 25, 2025
Merged

perf: skip tag render when there is no swigTags#5650
stevenjoezhang merged 4 commits intohexojs:masterfrom
D-Sketon:perf/tag

Conversation

@D-Sketon
Copy link
Member

@D-Sketon D-Sketon commented Apr 5, 2025

Can we skip tag.render if there are no swig Tags?

@github-actions
Copy link

github-actions bot commented Apr 5, 2025

How to test

git clone -b perf/tag https://github.com/D-Sketon/hexo.git
cd hexo
npm install
npm test

@coveralls
Copy link

coveralls commented Apr 5, 2025

Pull Request Test Coverage Report for Build 14575855222

Details

  • 8 of 8 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 99.526%

Totals Coverage Status
Change from base Build 14575173355: 0.0%
Covered Lines: 9874
Relevant Lines: 9921

💛 - Coveralls

Copy link
Member

@yoshinorin yoshinorin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

lib/hexo/post.ts Outdated

// Return content after replace the placeholders
if (disableNunjucks) return data.content;
if (disableNunjucks || !hasTag) return data.content;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditional operator here is a bit hard to follow, but since I can't think of a better solution, I think this is fine as it is.

@stevenjoezhang stevenjoezhang requested a review from SukkaW April 21, 2025 15:17
@stevenjoezhang stevenjoezhang merged commit 16ff4a5 into hexojs:master Apr 25, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants