mirror of
https://github.com/imfing/hextra.git
synced 2025-08-23 13:26:54 -04:00

* refactor(math): update LaTeX guide and enhance KaTeX integration - Revised the LaTeX documentation for clarity and improved structure, changing section titles and descriptions for better understanding. - Added support for chemistry expressions using the mhchem extension. - Introduced a new KaTeX CSS loader partial to streamline the integration of KaTeX, allowing for configurable remote or local asset loading. - Updated the head partial to utilize the new KaTeX loader, enhancing the flexibility of math rendering options. * refactor(mathjax): simplify MathJax script URL configuration - Removed the dynamic version assignment for MathJax and set a fixed version in the script URL for consistency and clarity. * docs(latex): enhance LaTeX guide and clarify chemistry expressions - Updated section titles for better clarity, changing "Supported Functions" to "Chemistry Expressions." - Improved description of the mhchem extension for rendering chemistry equations. - Removed redundant instructions regarding the passthrough extension in Hugo. - Corrected minor typographical errors in references to MathJax.
97 lines
3.7 KiB
HTML
97 lines
3.7 KiB
HTML
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
{{- $noindex := .Params.noindex | default false -}}
|
||
{{ if and (hugo.IsProduction) (not $noindex) -}}
|
||
<meta name="robots" content="index, follow" />
|
||
{{ else -}}
|
||
<meta name="robots" content="noindex, nofollow" />
|
||
{{ end -}}
|
||
{{ partialCached "favicons.html" . -}}
|
||
<title>
|
||
{{- if .IsHome -}}
|
||
{{ .Site.Title -}}
|
||
{{ else -}}
|
||
{{ with .Title }}{{ . }} – {{ end -}}
|
||
{{ .Site.Title -}}
|
||
{{ end -}}
|
||
</title>
|
||
<meta name="description" content="{{ partial "utils/page-description.html" . }}" />
|
||
|
||
{{- with .Params.canonical -}}
|
||
<link rel="canonical" href="{{ . }}" itemprop="url" />
|
||
{{- else -}}
|
||
<link rel="canonical" href="{{ .Permalink }}" itemprop="url" />
|
||
{{- end -}}
|
||
|
||
{{- partial "opengraph.html" . -}}
|
||
{{- partial "schema.html" . -}}
|
||
{{- partial "twitter_cards.html" . -}}
|
||
|
||
{{- $mainCss := resources.Get "css/compiled/main.css" -}}
|
||
{{- $customCss := resources.Get "css/custom.css" -}}
|
||
{{- $variablesCss := resources.Get "css/variables.css" | resources.ExecuteAsTemplate "css/variables.css" . -}}
|
||
|
||
{{- /* Production build */ -}}
|
||
{{- if hugo.IsProduction }}
|
||
{{- $styles := slice $variablesCss $mainCss $customCss | resources.Concat "css/compiled/main.css" | minify | fingerprint }}
|
||
<link rel="preload" href="{{ $styles.RelPermalink }}" as="style" integrity="{{ $styles.Data.Integrity }}" />
|
||
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" integrity="{{ $styles.Data.Integrity }}" />
|
||
|
||
{{- /* Theme development mode (non-production + theme environment) */ -}}
|
||
{{- else if eq hugo.Environment "theme" }}
|
||
{{- $devStyles := resources.Get "css/styles.css" | postCSS (dict "inlineImports" true) }}
|
||
<link href="{{ $devStyles.RelPermalink }}" rel="stylesheet" />
|
||
<link href="{{ $variablesCss.RelPermalink }}" rel="stylesheet" />
|
||
<link href="{{ $customCss.RelPermalink }}" rel="stylesheet" />
|
||
|
||
{{- /* User local development */ -}}
|
||
{{- else }}
|
||
{{- $styles := resources.Get "css/compiled/main.css" -}}
|
||
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" />
|
||
<link href="{{ $variablesCss.RelPermalink }}" rel="stylesheet" />
|
||
<link href="{{ $customCss.RelPermalink }}" rel="stylesheet" />
|
||
{{- end }}
|
||
|
||
|
||
<!-- Google Analytics -->
|
||
{{- if and hugo.IsProduction .Site.Config.Services.GoogleAnalytics.ID }}
|
||
<link rel="preconnect" href="https://www.googletagmanager.com" crossorigin />
|
||
{{ partial "google-analytics.html" . -}}
|
||
{{- end }}
|
||
|
||
<script>
|
||
/* Initialize light/dark mode */
|
||
const defaultTheme = '{{ site.Params.theme.default | default `system`}}';
|
||
|
||
const setDarkTheme = () => {
|
||
document.documentElement.classList.add("dark");
|
||
document.documentElement.style.colorScheme = "dark";
|
||
}
|
||
const setLightTheme = () => {
|
||
document.documentElement.classList.remove("dark");
|
||
document.documentElement.style.colorScheme = "light";
|
||
}
|
||
|
||
if ("color-theme" in localStorage) {
|
||
localStorage.getItem("color-theme") === "dark" ? setDarkTheme() : setLightTheme();
|
||
} else {
|
||
defaultTheme === "dark" ? setDarkTheme() : setLightTheme();
|
||
if (defaultTheme === "system") {
|
||
window.matchMedia("(prefers-color-scheme: dark)").matches ? setDarkTheme() : setLightTheme();
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<!-- Math engine -->
|
||
{{ $noop := .WordCount -}}
|
||
{{- $engine := site.Params.math.engine | default "katex" -}}
|
||
{{ if and (.Page.Store.Get "hasMath") (eq $engine "katex") -}}
|
||
{{ partialCached "scripts/katex.html" . -}}
|
||
{{ else if and (.Page.Store.Get "hasMath") (eq $engine "mathjax") -}}
|
||
{{ partialCached "scripts/mathjax.html" . -}}
|
||
{{ end -}}
|
||
|
||
{{ partial "custom/head-end.html" . -}}
|
||
</head>
|