summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorAditya Telange <21258296+adityatelange@users.noreply.github.com>2021-09-11 11:09:01 +0530
committerAditya Telange <21258296+adityatelange@users.noreply.github.com>2021-09-11 11:09:01 +0530
commit4e9b04784bac6bbaabecdffc9fe6e513787b66d9 (patch)
treeed53239f2317cdf4ba863542a426055914a3a84a /layouts
parent8021be2ddb5336bcc84682d4702ec43b7a579b81 (diff)
Move `noscript` elements to head
- Should fix search engines picking up elements inside noscript
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/head.html43
-rw-r--r--layouts/partials/header.html39
2 files changed, 42 insertions, 40 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 08ad70a..28abcd9 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -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 */}}
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 8750e9b..f53ab52 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -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">