layouts/partials/head.html (64 lines of code) (raw):
<script>
// Applica immediatamente la modalità scura se salvata in localStorage
(function() {
const currentTheme = localStorage.getItem('theme');
if (currentTheme === 'dark') {
document.documentElement.classList.add('dark-mode');
} else if (currentTheme === 'light') {
document.documentElement.classList.remove('dark-mode');
}
const isDarkMode = document.documentElement.classList.contains('dark-mode');
const themeIcon = document.getElementById('theme-icon');
if (themeIcon) {
themeIcon.classList && themeIcon.classList.toggle('fa-sun', !isDarkMode);
themeIcon.classList && themeIcon.classList.toggle('fa-moon', isDarkMode);
}
})();
</script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{{ range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end -}}
{{ $outputFormat := partial "outputformat.html" . -}}
{{ if and hugo.IsProduction (ne $outputFormat "print") -}}
<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="{{ template "partials/page-description.html" . }}">
{{ template "_internal/opengraph.html" . -}}
{{ template "_internal/schema.html" . -}}
{{ template "_internal/twitter_cards.html" . -}}
{{ partialCached "head-css.html" . "head-css-cache-key" -}}
<script src="{{ .Site.BaseURL }}js/jquery-3.7.1.min.js"></script>
{{ if .Site.Params.offlineSearch -}}
<script defer src="{{ .Site.BaseURL }}js/lunr-2.3.9.min.js"></script>
{{ end -}}
{{ if .Site.Params.prism_syntax_highlighting -}}
<link rel="stylesheet" href="{{ "css/prism.css" | relURL }}"/>
{{ end -}}
{{ template "algolia/head" . -}}
{{ partial "hooks/head-end.html" . -}}
{{/* To comply with GDPR, cookie consent scripts places in head-end must execute before Google Analytics is enabled */ -}}
{{ if hugo.IsProduction -}}
{{ template "_internal/google_analytics.html" . -}}
{{ end -}}
{{ define "algolia/head" -}}
{{ if and .Site.Params.search (isset .Site.Params.search "algolia") -}}
<link rel="stylesheet" href="{{ .Site.BaseURL }}/css/docsearch-3.6.0.min.css"/>
{{ end -}}
{{ if ne .Site.Params.algolia_docsearch nil -}}
{{ warnf `Config 'params.algolia_docsearch' is deprecated: use 'params.search.algolia'
For details, see https://www.docsy.dev/docs/adding-content/search/#algolia-docsearch.` -}}
{{ end -}}
{{ end -}}