aboutsummaryrefslogtreecommitdiffstats
path: root/layouts/_default/search.html
blob: e61c9a0004d2a65c5a24adba68405c1dd0fb9c76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{{ define "main" }}
  <div class="max-w-screen-md mx-auto p-1">
    <header>
      <h2 class="baskerville px-1">
        {{ T "search" | humanize }}
      </h2>
    </header>

    <form action="{{ .Permalink }}">
      <input
        id="search-query"
        name="q"
        placeholder="{{ T "search_placeholder" }}"
        class="p-2 w-full border"
      />
    </form>

    <div id="search-results" class="my-2">
      <p class="p-4 text-xl font-semibold text-center">
        {{ T "search_request" }}
      </p>
    </div>
  </div>

  <template id="no-match">
    <p
      class="bg-red-100 p-4 text-red-600 text-xl font-semibold text-center border rounded border-current"
    >
      {{ T "no_match_found" }}
    </p>
  </template>
  <template id="search-result-template">
    <article class="py-2 border-y border-gray-200 search_summary">
      <a class="hover:opacity-50 search_link" href="">
        <time class="float-right text-sm px-8 search_time"></time>
        <h4 class="baskerville my-2 search_title"></h4>
        <div class="search_snippet"></div>
      </a>
    </article>
  </template>
  <script
    async
    src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/7.0.0/fuse.min.js"
    integrity="sha512-GrJ4P9yra6dftp5O0eaKFKS4ch1FYn1xR/VCHQIMJO1LNqcKhjkAkAETHYoE81Ffh3BjCJMWA/AZSYP521jxFA=="
    crossorigin="anonymous"
    referrerpolicy="no-referrer"
  ></script>

  {{ with resources.Get "js/search.js" | resources.Minify | fingerprint }}
    <script
      async
      src="{{ .RelPermalink }}"
      integrity="{{ .Data.Integrity }}"
      crossorigin="anonymous"
      referrerpolicy="no-referrer"
    ></script>
  {{ end }}
{{ end }}