From 90a5c66d8ba95bcb860906fd848dfa2f91817ea1 Mon Sep 17 00:00:00 2001 From: Junyi Hou Date: Tue, 9 Apr 2024 20:30:37 +0800 Subject: [PATCH] add: Added on-demand mathjax load to speedup performance --- exampleSiteMultilingual/hugo.toml | 2 +- layouts/partials/header.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/exampleSiteMultilingual/hugo.toml b/exampleSiteMultilingual/hugo.toml index 762083d..2be01ba 100644 --- a/exampleSiteMultilingual/hugo.toml +++ b/exampleSiteMultilingual/hugo.toml @@ -25,7 +25,7 @@ readNextPosts = 2 copyCodeButton = true rssAsSocialIcon = true locale = "en-us" -mathjax = true +math = false # true: enable mathjax globally (default is false) toc = true # Graphcomment support diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 1cd71a7..d97227d 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -20,6 +20,7 @@ {{ end }} -{{ if .Site.Params.mathjax }}{{ partial "mathjax_support.html" . }}{{ end }} +{{/* .Params is the current page config. .Site.Params is globall config in hugo.toml */}} +{{ if or .Site.Params.math .Params.math }}{{ partial "mathjax_support.html" . }}{{ end }} {{ partial "header-extra.html" . }}