Closed 000yesnt closed 1 year ago
Thanks for reporting this, but we can’t fix this in any good way.
has_math
but no math (or no content at all) is perhaps the user’s mistake. A post with has_math
but all math appearing outside of the teaser would be the only relevant case (and something that might happen in real life, especially if the teasers are short or if there isn’t much math in the post in the first place). But, as mentioned before, there is no way for us to reliably determine this.math_scripts_ifposts
and math_styles_ifposts
in math_helper.tmpl
. If you use math only in a handful of teasers, you could add a custom metadata field (teaser_has_math
) and modify those functions to check the new field.
Environment
Python Version: Python 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)] on win32
Nikola Version: 8.2.3
Operating System: Windows 10 10.0.19045.2604
Description:
When a post with the
has_math: true
metadata field is shown on the site index, MathJax is loaded regardless of whether there's any visible LaTeX, wasting bandwidth.For example, with index teasers enabled and
END_TEASER
placed before the math directive, MathJax loads. This also seems to happen when a post has no content, buthas_math
is on.No other settings were changed; this is a fully stock Nikola site.
Screenshots: