mirror of
https://github.com/foo-dogsquared/hugo-theme-more-contentful.git
synced 2025-01-30 22:57:57 +00:00
Move persistent theme script earlier
This makes it faster for the perceived performance and placing it the moment after loading the stylesheet is the quickest way to avoid unstyled flash of content.
This commit is contained in:
parent
b8ff9e866f
commit
db5a0b48de
@ -18,6 +18,14 @@
|
||||
{{- $style = $style | resources.Minify | resources.Fingerprint -}}
|
||||
{{- end }}
|
||||
<link rel="stylesheet" href="{{ $style.Permalink }}" />
|
||||
{{- /* Persistent theme.
|
||||
It's a very small script so there's little effect on perceived performance. */ -}}
|
||||
<script>
|
||||
let theme = window.localStorage.getItem('theme');
|
||||
if (theme) {
|
||||
document.documentElement.dataset.theme = theme;
|
||||
}
|
||||
</script>
|
||||
|
||||
<link rel="shortcut icon" href="{{ absURL "favicon.png" }}" />
|
||||
|
||||
@ -50,13 +58,3 @@
|
||||
{{ template "_internal/disqus.html" . }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{- /* Persistent theme.
|
||||
It's a very small script so there's little effect on perceived performance. */ -}}
|
||||
<script>
|
||||
let theme = window.localStorage.getItem('theme');
|
||||
if (theme) {
|
||||
document.documentElement.dataset.theme = theme;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user