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.

97 lines
2.5 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. {{ define "header" }}
  16. {{ partial "masthead.html" . }}
  17. {{ end }}
  18. {{ define "main" }}
  19. <header>
  20. <h1>{{ .Title }}</h1>
  21. {{ if .Description }}
  22. <blockquote itemprop="description">{{ .Description }}</blockquote>
  23. {{ end }}
  24. </header>
  25. {{ .Content }}
  26. <style>
  27. dl {
  28. display: grid;
  29. grid-template-columns: repeat(1, 1fr 2fr);
  30. grid-gap: 1rem;
  31. }
  32. dt {
  33. text-align: right;
  34. }
  35. dd {
  36. margin-inline-start: unset;
  37. margin-bottom: 2rem;
  38. }
  39. .hack article:first-of-type h2 {
  40. margin-top: 30px;
  41. }
  42. .hack h2 {
  43. position: sticky;
  44. top: 20px;
  45. padding: 5px;
  46. background-color: #1976d215;
  47. margin: -20px 0 30px;
  48. }
  49. .hack h2:before {
  50. content: ">> ";
  51. }
  52. .hack h2:after {
  53. content: " <<";
  54. }
  55. @media screen and (min-width: 30em) {
  56. dl {
  57. grid-template-columns: repeat(2, 1fr 2fr);
  58. }
  59. .hack h2 {
  60. text-align: center;
  61. }
  62. }
  63. </style>
  64. {{ $scratch := newScratch }}
  65. {{ range .Paginator.Pages }}
  66. {{ $scratch.Add "categories" .Params.categories | first 1 }}
  67. {{ end }}
  68. {{ $categories := $scratch.Get "categories" | uniq }}
  69. <nav class="alert alert-info">
  70. <b>Category:</b>
  71. {{ range $categories }}
  72. <a href="#{{ . | anchorize }}">{{ . | title }}</a>
  73. {{ end }}
  74. </nav>
  75. {{ range $categories }}
  76. <article>
  77. <h2 id="{{ . | anchorize }}">{{ . | title }}</h2>
  78. <dl>
  79. {{ range where $.Paginator.Pages "Params.categories" "intersect" (slice .) }}
  80. <dt><a href="{{ .RelPermalink }}">{{ .Title }}</a>
  81. <dd>{{ .Description }}
  82. {{ end }}
  83. </dl>
  84. </article>
  85. {{ end }}
  86. {{ end }}
  87. {{ define "footer" }}
  88. <p>{{ partial "pagination.html" . }}</p>
  89. <small class="muted">
  90. {{ partial "copyright-notice.html" . }}
  91. </small>
  92. {{ end }}