diff options
author | AmazingRise <8315221+AmazingRise@users.noreply.github.com> | 2022-08-26 07:43:00 +0300 |
---|---|---|
committer | AmazingRise <8315221+AmazingRise@users.noreply.github.com> | 2022-08-26 07:43:00 +0300 |
commit | 1adda175206fb128dd1dfe4935215be5bfa93b0b (patch) | |
tree | 4c84678a63fc00f16181738eaee97fa1c85ab7f8 /layouts | |
parent | 5017b8bb9533ac5801918d05f67e13a9d6881859 (diff) |
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/baseof.html | 11 | ||||
-rw-r--r-- | layouts/partials/head.html | 39 |
2 files changed, 40 insertions, 10 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 757b685..5cbe2a2 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -19,6 +19,15 @@ <!-- mobile footer --> </div> {{ partial "journal.html" .}} - <script src="{{"/js/journal.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="{{"js/journal.js" | relURL}}"></script> + {{- else -}} + {{- /* with leading slash */ -}} + <script src="{{"/js/journal.js" | relURL}}"></script> + {{- end -}} + </body> </html> 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 }}', |