Move noscript elements to head

- Should fix search engines picking up elements inside noscript
This commit is contained in:
Aditya Telange 2021-09-11 11:09:01 +05:30
parent 8021be2ddb
commit 4e9b04784b
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
2 changed files with 42 additions and 40 deletions

View File

@ -113,7 +113,48 @@
{{ end -}}
{{- range .AllTranslations -}}
<link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}" />
{{ end }}
{{ end -}}
<noscript>
<style>
#theme-toggle,
.top-link {
display: none;
}
</style>
{{- if (and (ne .Site.Params.defaultTheme "light") (ne .Site.Params.defaultTheme "dark")) }}
<style>
@media (prefers-color-scheme: dark) {
:root {
--theme: #1d1e20;
--entry: #2e2e33;
--primary: rgba(255, 255, 255, 0.84);
--secondary: rgba(255, 255, 255, 0.56);
--tertiary: rgba(255, 255, 255, 0.16);
--content: rgba(255, 255, 255, 0.74);
--hljs-bg: #2e2e33;
--code-bg: #37383e;
--border: #333;
}
.list {
background: var(--theme);
}
.list:not(.dark)::-webkit-scrollbar-track {
background: 0 0;
}
.list:not(.dark)::-webkit-scrollbar-thumb {
border-color: var(--theme);
}
}
</style>
{{- end }}
</noscript>
{{- partial "extend_head.html" . -}}
{{- /* Misc */}}

View File

@ -38,45 +38,6 @@
</script>
{{- end }}
<noscript>
<style type="text/css">
#theme-toggle,
.top-link {
display: none;
}
</style>
{{- if (and (ne .Site.Params.defaultTheme "light") (ne .Site.Params.defaultTheme "dark")) }}
<style>
@media (prefers-color-scheme: dark) {
:root {
--theme: #1d1e20;
--entry: #2e2e33;
--primary: rgba(255, 255, 255, 0.84);
--secondary: rgba(255, 255, 255, 0.56);
--tertiary: rgba(255, 255, 255, 0.16);
--content: rgba(255, 255, 255, 0.74);
--hljs-bg: #2e2e33;
--code-bg: #37383e;
--border: #333;
}
.list {
background: var(--theme);
}
.list:not(.dark)::-webkit-scrollbar-track {
background: 0 0;
}
.list:not(.dark)::-webkit-scrollbar-thumb {
border-color: var(--theme);
}
}
</style>
{{- end }}
</noscript>
<header class="header">
<nav class="nav">