From 5d596bd3d5cb8c685a96dc836fc8441894c19c7c Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Mon, 4 Sep 2023 18:16:29 +0800 Subject: [PATCH] favicon html --- docSite/layouts/partials/docs/favicon.html | 18 +++ docSite/layouts/partials/docs/head.html | 148 +++++++++++---------- 2 files changed, 93 insertions(+), 73 deletions(-) create mode 100644 docSite/layouts/partials/docs/favicon.html diff --git a/docSite/layouts/partials/docs/favicon.html b/docSite/layouts/partials/docs/favicon.html new file mode 100644 index 000000000..0e386dfd3 --- /dev/null +++ b/docSite/layouts/partials/docs/favicon.html @@ -0,0 +1,18 @@ +{{ if os.FileExists "static/favicon.ico" -}} + +{{ end -}} +{{ if os.FileExists "static/favicon.svg" -}} + +{{ end -}} +{{ if os.FileExists "static/apple-touch-icon.png" -}} + +{{ end -}} +{{ if os.FileExists "static/favicon-32x32.png" -}} + +{{ end -}} +{{ if os.FileExists "static/favicon-16x16.png" -}} + +{{ end -}} +{{ if os.FileExists "static/site.webmanifest" -}} + +{{ end -}} \ No newline at end of file diff --git a/docSite/layouts/partials/docs/head.html b/docSite/layouts/partials/docs/head.html index 2a7abe242..47b5cc422 100644 --- a/docSite/layouts/partials/docs/head.html +++ b/docSite/layouts/partials/docs/head.html @@ -1,74 +1,76 @@ - - - {{- $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }} - {{- if eq $url "/" }} - {{- .Site.Title }} - {{- else }} - {{- if .Params.heading }} - {{ .Params.heading }} - {{ else }} - {{- if eq .Title .Site.Title }} - {{- .Title }} - {{- else }} - {{ .Site.Params.docs.Title | default (.Site.Title) }} | {{ .Title }} - {{- end }} - {{- end }} - {{- end -}} - - {{- if not hugo.IsProduction }} - - {{- end }} - - - - - - - - - {{ block "favicon" . }}{{ partialCached (printf "%s/%s" ($.Scratch.Get "pathName") "head/favicon.html") . }}{{ end }} - - {{ if eq .Site.Params.docs.darkMode true -}} - {{ $darkModeInit := resources.Get (printf "/%s/%s" ($.Scratch.Get "pathName") "js/darkmode-init.js") | js.Build | minify -}} - - {{ end -}} - - {{ if or (not (isset .Site.Params.flexsearch "enabled")) (eq .Site.Params.flexsearch.enabled true) -}} - {{ if and (.Site.Params.docsearch.appID) (.Site.Params.docsearch.apiKey) -}} - {{ else }} - {{ $flexSearch := resources.Get (printf "/%s/%s" ($.Scratch.Get "pathName") "js/flexsearch.bundle.js") }} - {{- if not .Site.IsServer }} - {{ $flexSearch := $flexSearch | minify | fingerprint "sha384" }} - - {{ else }} - - {{ end }} - {{ end }} - {{ end }} - - {{- partialCached "google-fonts" . }} - - {{- $options := dict "enableSourceMap" true }} - {{- if hugo.IsProduction}} - {{- $options := dict "enableSourceMap" false "outputStyle" "compressed" }} - {{- end }} - {{- $style := resources.Get (printf "/%s/%s" ($.Scratch.Get "pathName") "scss/style.scss") }} - {{- $style = $style | resources.ExecuteAsTemplate (printf "/%s/%s" ($.Scratch.Get "pathName") "scss/style.scss") . | resources.ToCSS $options }} - {{- if hugo.IsProduction }} - {{- $style = $style | minify | fingerprint "sha384" }} - {{- end -}} - - - {{- if not .Site.IsServer }} - {{ if and (.Site.Params.plausible.scriptURL | default "https://plausible.io") (.Site.Params.plausible.dataDomain) -}} - {{- partialCached (printf "%s/%s" ($.Scratch.Get "pathName") "head/plausible") . }} - {{- end -}} - {{- end -}} - - {{- if not .Site.IsServer }} - {{- if .Site.GoogleAnalytics }} - {{- template "_internal/google_analytics.html" . -}} - {{- end -}} - {{- end -}} - \ No newline at end of file + + + {{- $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }} {{- if eq $url "/" }} {{- + .Site.Title }} {{- else }} {{- if .Params.heading }} {{ .Params.heading }} {{ else }} {{- if eq + .Title .Site.Title }} {{- .Title }} {{- else }} {{ .Site.Params.docs.Title | default + (.Site.Title) }} | {{ .Title }} {{- end }} {{- end }} {{- end -}} + + {{- if not hugo.IsProduction }} + + {{- end }} + + + + + + + + + {{ block "favicon" . }}{{ partialCached (printf "%s/%s" ($.Scratch.Get "pathName") + "head/favicon.html") . }}{{ end }} + + {{ if eq .Site.Params.docs.darkMode true -}} {{ $darkModeInit := resources.Get (printf "/%s/%s" + ($.Scratch.Get "pathName") "js/darkmode-init.js") | js.Build | minify -}} + + {{ end -}} + + {{ if or (not (isset .Site.Params.flexsearch "enabled")) (eq .Site.Params.flexsearch.enabled true) + -}} {{ if and (.Site.Params.docsearch.appID) (.Site.Params.docsearch.apiKey) -}} {{ else }} {{ + $flexSearch := resources.Get (printf "/%s/%s" ($.Scratch.Get "pathName") + "js/flexsearch.bundle.js") }} {{- if not .Site.IsServer }} {{ $flexSearch := $flexSearch | minify + | fingerprint "sha384" }} + + {{ else }} + + {{ end }} {{ end }} {{ end }} + + {{- partialCached "google-fonts" . }} + + {{- $options := dict "enableSourceMap" true }} {{- if hugo.IsProduction}} {{- $options := dict + "enableSourceMap" false "outputStyle" "compressed" }} {{- end }} {{- $style := resources.Get + (printf "/%s/%s" ($.Scratch.Get "pathName") "scss/style.scss") }} {{- $style = $style | + resources.ExecuteAsTemplate (printf "/%s/%s" ($.Scratch.Get "pathName") "scss/style.scss") . | + resources.ToCSS $options }} {{- if hugo.IsProduction }} {{- $style = $style | minify | fingerprint + "sha384" }} {{- end -}} + + + {{- if not .Site.IsServer }} {{ if and (.Site.Params.plausible.scriptURL | default + "https://plausible.io") (.Site.Params.plausible.dataDomain) -}} {{- partialCached (printf "%s/%s" + ($.Scratch.Get "pathName") "head/plausible") . }} {{- end -}} {{- end -}} + + {{- if not .Site.IsServer }} {{- if .Site.GoogleAnalytics }} {{- template + "_internal/google_analytics.html" . -}} {{- end -}} {{- end -}} +