Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/chipzoller/hugo-clarity.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweru <fromweru@gmail.com>2022-05-13 20:25:53 +0300
committerweru <16350351+onweru@users.noreply.github.com>2022-05-17 02:38:18 +0300
commit3ceec26c66cb05bb6c585c72e5de6df31abcf4df (patch)
treec7437e8e26c528ef86cb6f3ffddb4902a9362f35
parent9a8f1fc38d3fe696c28b5adfe0b59088269c210d (diff)
move preloads & style links to 'head' template
Signed-off-by: weru <fromweru@gmail.com>
-rw-r--r--layouts/_default/baseof.html15
-rw-r--r--layouts/partials/head.html21
2 files changed, 20 insertions, 16 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 8cd0002..1d555da 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -4,21 +4,6 @@
<html lang="{{ .Lang }}" data-figures="{{ $p.figurePositionShow }}"{{ if .IsPage }} class="page"{{ end }}{{ if .IsHome }} class="home"{{ end }}{{ with $s.enforceLightMode }} data-mode="lit"{{ end }}{{ with $s.enforceDarkMode }} data-mode="dim"{{ end }}>
<head>
{{- partial "head" . }}
-
- {{ $styles := partialCached "func/getStylesBundle" . }}
- {{ $bundle := partialCached "func/getJavascriptBundle" . }}
- <!-- preload assets declaration -->
- <link rel="preload" href="{{ $styles.Permalink }}" integrity = "{{ $styles.Data.Integrity }}" as="style" crossorigin="anonymous">
- <link rel="preload" href="{{ $bundle.Permalink }}" as="script" integrity=
- "{{ $bundle.Data.Integrity }}" crossorigin="anonymous">
-
- <!-- styles file -->
- <link rel="stylesheet" type="text/css" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" crossorigin="anonymous">
- {{- with $s.customCSS }}
- {{- range . -}}
- <link rel="stylesheet" href="{{ relURL . }}">
- {{- end }}
- {{- end }}
{{ partial "hooks/head-end.html" . }}
</head>
{{- $maxCodeLines := 100 }}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 6970eb9..ea2147a 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -1,4 +1,4 @@
-{{- $params := .Site.Params }}
+{{- $params := site.Params }}
{{- $separator := default "|" $params.titleSeparator }}
{{- $title := "" }}
{{- if and .Title (ne (trim (lower .Site.Title) "") (trim (lower .Title) "")) }}
@@ -24,3 +24,22 @@
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
+
+<!-- preload assets declaration -->
+<!-- preload main css file -->
+{{ $styles := partialCached "func/getStylesBundle" . }}
+<link rel="preload" href="{{ $styles.Permalink }}" integrity = "{{ $styles.Data.Integrity }}" as="style" crossorigin="anonymous">
+
+<!-- preload main javascript file -->
+{{ $bundle := partialCached "func/getJavascriptBundle" . }}
+<link rel="preload" href="{{ $bundle.Permalink }}" as="script" integrity=
+"{{ $bundle.Data.Integrity }}" crossorigin="anonymous">
+
+<!-- link main css file -->
+<link rel="stylesheet" type="text/css" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" crossorigin="anonymous">
+<!-- load all custom css files -->
+{{- with $params.customCSS }}
+ {{- range . -}}
+ <link rel="stylesheet" href="{{ relURL . }}">
+ {{- end }}
+{{- end }}