diff options
Diffstat (limited to 'layouts/partials/head.html')
-rw-r--r-- | layouts/partials/head.html | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 9a08420..29a50ec 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -31,7 +31,7 @@ {{ template "_internal/google_analytics.html" . }} {{ end }} -<link type="text/css" rel="stylesheet" href="{{"/vendor/css/bootstrap.min.css" | relURL}}"> + {{if .Site.Params.manifest}} <link rel="manifest" href="{{.Site.Params.manifest}}"> @@ -54,10 +54,25 @@ <link rel="stylesheet" href="{{ $darkmode.RelPermalink }}" integrity="{{ $darkmode.Data.Integrity }}" media="screen"> {{ end }} -<script src="{{"/vendor/js/loadCSS.js" | relURL}}"></script> -<script> - loadCSS("https://fonts.googleapis.com/css?family=Fira+Mono|Material+Icons"); -</script> + +<!-- For compatibility. View https://github.com/AmazingRise/hugo-theme-diary/pull/135 for details.--> +{{- $hugoVersion := split (replaceRE ".*([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "$1 $2 $3" hugo.Version) " " -}} +{{- if and (eq (int (index $hugoVersion 0)) 0) (ge (int (index $hugoVersion 1)) 101) -}} + {{- /* no leading slash */ -}} + {{ if and (not (.Params.disableToC) ) (.IsPage) }} + <script src="{{"js/toc.js" | relURL}}"></script> + {{ end }} + <link type="text/css" rel="stylesheet" href="{{"vendor/css/bootstrap.min.css" | relURL}}"> +{{- else -}} + {{- /* with leading slash */ -}} + {{ if and (not (.Params.disableToC) ) (.IsPage) }} + <script src="{{"/js/toc.js" | relURL}}"></script> + {{ end }} + <link type="text/css" rel="stylesheet" href="{{"/vendor/css/bootstrap.min.css" | relURL}}"> +{{- end -}} + +<link rel="stylesheet" + href="https://fonts.googleapis.com/css?family=Material+Icons"> {{ if .Site.Params.cloudflareToken }} <!-- Cloudflare Web Analytics --> @@ -90,14 +105,20 @@ </script> {{ end }} -{{ if and (not (.Params.disableToC) ) (.IsPage) }} - <script src="{{"/js/toc.js" | relURL}}"></script> -{{ end }} + {{ if and ( and ( .Site.Params.enableGitalk ) ( .IsPage ) ) ( or ( not ( isset .Params "comment" ) ) ( eq .Params.comment true ) ) }} <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css"> <script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script> -<script src="{{"/vendor/js/md5.min.js" | relURL}}"></script> +<!-- For compatibility. View https://github.com/AmazingRise/hugo-theme-diary/pull/135 for details.--> +{{- $hugoVersion := split (replaceRE ".*([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "$1 $2 $3" hugo.Version) " " -}} +{{- if and (eq (int (index $hugoVersion 0)) 0) (ge (int (index $hugoVersion 1)) 101) -}} + {{- /* no leading slash */ -}} + <script src="{{"vendor/js/md5.min.js" | relURL}}"></script> +{{- else -}} + {{- /* with leading slash */ -}} + <script src="{{"/vendor/js/md5.min.js" | relURL}}"></script> +{{- end -}} <script> var gitalk = new Gitalk({ clientID: '{{ .Site.Params.Gitalk.client_id }}', |