You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
4.4 KiB

4 years ago
  1. {{/*
  2. Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
  3. This file is part of After Dark.
  4. After Dark is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU Affero General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. After Dark is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. */ -}}
  15. <!doctype html>
  16. <html lang="{{ .Site.LanguageCode }}">
  17. <head>
  18. {{ partial "meta/content-security-policy.html" . }}
  19. <meta name="generator" content="After Dark Hugo">
  20. <meta charset="utf-8">
  21. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  22. <title>{{ block "title" . }}{{ .Title }} | {{ .Site.Title }}{{ end }}</title>
  23. <meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
  24. <meta name="keywords" content="{{ if .Keywords }}{{ delimit .Keywords ", " }}{{ else if and .IsPage .Params.tags }}{{ delimit .Params.tags ", " }}{{ else }}{{ range $term, $val := .Site.Taxonomies.categories }}{{ lower (humanize $term) }}, {{ end }}{{ end }}">
  25. {{ $default_noindex_kinds := slice "section" "taxonomy" "taxonomyTerm" }}
  26. {{ $noindex_kinds := .Site.Params.noindex_kinds | default $default_noindex_kinds }}
  27. {{ $is_noindex_true := and (isset .Params "noindex") .Params.noindex }}
  28. {{ if or (in $noindex_kinds .Kind) ($is_noindex_true) }}
  29. <meta name="robots" content="noindex">
  30. {{ end }}
  31. {{ template "_internal/opengraph.html" . }}
  32. {{ template "_internal/twitter_cards.html" . }}
  33. {{ partial "meta/ogimage-maybe.html" . }}
  34. {{ partial "meta/telegram-channel-maybe.html" . }}
  35. {{ if eq .Kind "home" }}
  36. {{ partial "meta/verifications.html" . }}
  37. {{ end }}
  38. {{ partial "meta/http-referrer.html" . }}
  39. {{ $import := resources.Get "/js/vendor/fetch-inject.min.js" }}
  40. {{ $baseof := resources.Get "/js/baseof.js" | resources.ExecuteAsTemplate "baseof.js" . }}
  41. <script integrity="{{ ($import | resources.Fingerprint "sha512").Data.Integrity }}">
  42. {{- $import.Content | safeJS -}}
  43. </script>
  44. <script integrity="{{ ($baseof | resources.Fingerprint "sha512").Data.Integrity }}">
  45. {{- $baseof.Content | safeJS -}}
  46. </script>
  47. {{ partial "head/modules.html" . }}
  48. {{ with .OutputFormats.Get "rss" }}
  49. {{ printf "<link rel=\"%s\" type=\"%s\" href=\"%s\" title=\"%s\">" .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
  50. {{ end }}
  51. <link rel="canonical" href="{{ .Permalink }}">
  52. {{ if (isset .Params "prev") }}
  53. <link rel="prev" href="{{ .Params.prev }}">
  54. {{ end }}
  55. {{ if (isset .Params "next") }}
  56. <link rel="next" href="{{ .Params.next }}">
  57. {{ end }}
  58. {{ partial "head/favicon.html" . }}
  59. {{ partial "global-styles.html" . }}
  60. {{ $highlights := findRE "class\\s*?=\\s*?\".*?\\bhighlight\\b.*?\"|class\\s*?=\\s*?highlight\\b" .Content }}
  61. {{ if ge (len $highlights) 1 }}
  62. <script integrity="sha512-ISTAV0GadOIz/NXXHOS+eCM0ysXVVHhQTlvA6LJxz/DeA5yIxm0Vqf5IE+WH0yuuXkayAKtoZkQ326nch5f/fg==">fetchInject([{{ "/css/syntax.css" | relURL }}]);</script>
  63. <noscript>
  64. <link href="{{ "/css/syntax.css" | relURL }}" rel="stylesheet">
  65. </noscript>
  66. {{ end }}
  67. </head>
  68. {{ $hackcss_disabled := .Site.Params.hackcss.disabled | default false }}
  69. {{ $hackcss_mode := .Site.Params.hackcss.mode | default "hack" }}
  70. {{ $hackcss_palette := .Site.Params.hackcss.palette | default "dark" }}
  71. <body class="{{ if ne $hackcss_disabled true }}{{ $hackcss_mode }} {{ $hackcss_palette }} main container{{ end }}">
  72. <header>{{ block "header" . }}{{ end }}</header>
  73. <main>{{ block "main" . }}{{ end }}</main>
  74. <footer>{{ block "footer" . }}{{ end }}</footer>
  75. {{ $defaults := .Site.Params.defaults.modules }}
  76. {{ $modules := .Site.Params.modules }}
  77. {{ if (or $modules $defaults) }}
  78. {{ with (default $defaults.toxic_swamp $modules.toxic_swamp) }}
  79. {{ partial "modules/toxic-swamp/toolbar.html" dict }}
  80. {{ end }}
  81. {{ end }}
  82. </body>
  83. </html>