Skip to content

Math script loaded in tags and archives pages [solved] #78

@wafer-li

Description

@wafer-li

I agree and want to create new issue


Expected behavior

Math script won't be loaded with no math in tags, achives pages etc.

Actual behavior

Math sript loaded in tags, achives pages etc. even if there is no math in homepage.

Steps to reproduce the behavior

  1. Turn on enable of math
  2. hexo clean && hexo g -d

This line, for now, per_page default to true, then not theme.math.per_page will befalse.

And if we are at homepage now, page.total will be true, therefore even if page.mathjax is false, the(page.total or page.mathjax) still be true.

Finally, after those determinations, the if not theme.math.per_page or (page.total or page.mathjax) will return true and load the math script.

Since the tags and achives pages has the post.total property, and it will load the math script in tags and achives pages.

Node.js and NPM Information


Package dependencies Information


Hexo Information

Hexo version


Hexo Configuration

NexT Information

NexT Version:

[x] Latest Master branch.
[] Latest Release version.
[] Old version -

NexT Scheme:

[x] All schemes
[] Muse
[] Mist
[] Pisces
[] Gemini

NexT Configuration:

# Math Equations Render Support
math:
  enable: true

  # Default(true) will load mathjax/katex script on demand
  # That is it only render those page who has 'mathjax: true' in Front Matter.
  # If you set it to false, it will load mathjax/katex srcipt EVERY PAGE.
  per_page: true

  #engine: mathjax
  engine: katex

Other Information

And there is the screenshot:

image

I have no math in my homepage, but it still load the Katex CSS.

And in achives too:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions