Skip to content

Commit 2a69cf1

Browse files
authored
Merge pull request #81 from theme-next/fix-math-load
Fix #78
2 parents 72558c4 + 24340d2 commit 2a69cf1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

layout/_third-party/math/index.swig

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
{% if theme.math.enable %}
2-
{% if not theme.math.per_page or (page.total or page.mathjax) %}
2+
{% set is_index_has_math = false %}
3+
4+
{# At home, check if there has `mathjax: true` post #}
5+
{% if is_home() %}
6+
{% for post in page.posts %}
7+
{% if post.mathjax and not is_index_has_math %}
8+
{% set is_index_has_math = true %}
9+
{% endif %}
10+
{% endfor %}
11+
{% endif %}
12+
13+
{% if not theme.math.per_page or (is_index_has_math or page.mathjax) %}
314
{% if theme.math.engine == 'mathjax' %}
415
{% include 'mathjax.swig' %}
516
{% elif theme.math.engine == 'katex' %}
617
{% include 'katex.swig' %}
718
{% endif %}
819
{% endif %}
920
{% endif %}
10-

0 commit comments

Comments
 (0)