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.

70 lines
2.8 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 "title" -}}
  16. {{ .Title }} | {{ .Site.Title }}
  17. {{- end }}
  18. {{ define "header" }}
  19. {{ partial "masthead.html" . }}
  20. {{ end }}
  21. {{ define "main" }}
  22. <header>
  23. <h1>{{ .Title }}</h1>
  24. </header>
  25. <div id="search-app" v-cloak>
  26. {{ with resources.Get "css/conditional/layouts/search.css" | minify }}
  27. <style>{{ .Content | safeCSS }}</style>
  28. {{ end }}
  29. <section>
  30. <form v-on:submit.prevent role="search" class="form" action="{{ "search" | absURL }}">
  31. <fieldset class="form-group">
  32. <input v-model="query" id="query" name="s" type="search" class="form-control" maxlength="32" autocomplete="off"{{ with .Params.form.input.placeholder }} placeholder="{{ . }}"{{ end }}{{ if eq .Params.form.input.disabled true }} disabled{{ end }}>
  33. {{ with .Params.form.helpblock }}
  34. <div class="help-block js-cloaked">{{ . | safeHTML }}</div>
  35. {{ end }}
  36. <div class="help-block js-initializing">{{/* placeholder */}}</div>
  37. </fieldset>
  38. </form>
  39. </section>
  40. <noscript>
  41. <p>Cannot initialize. Search requires JavaScript to function.</p>
  42. </noscript>
  43. <section v-if="results.length" class="js-cloaked">
  44. <p><i>Showing results for “{ resultsForSearch }”.</i></p>
  45. <div id="search-results">
  46. <article v-for="result in results" itemscope itemtype="https://schema.org/CreativeWork">
  47. <header itemprop="name">
  48. <h2 itemprop="name"><a :href="result.item.url">{ result.item.title }</a></h2>
  49. </header>
  50. <div v-html=result.item.summary itemprop="description"></div>
  51. <nav class="readmore"><p><a itemprop="url" :href="result.item.url">Read More&nbsp;&raquo;</a></p></nav>
  52. </article>
  53. </div>
  54. </section>
  55. </div>
  56. {{ end }}
  57. {{ define "footer" }}
  58. <small class="muted">
  59. {{ partial "copyright-notice.html" . }}
  60. </small>
  61. {{ $script := resources.Get "/js/search.js" | resources.ExecuteAsTemplate "search.js" . }}
  62. <script integrity="{{ printf "%s" ($script | resources.Fingerprint "sha512").Data.Integrity | safeHTML }}">
  63. {{- $script.Content | safeJS -}}
  64. </script>
  65. {{ end }}