search.html 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. {{ define "body-class" }}template-search{{ end }}
  2. {{ define "head" }}
  3. {{- with .OutputFormats.Get "json" -}}
  4. <link rel="preload" href="{{ .Permalink }}" as="fetch" crossorigin="anonymous">
  5. {{- end -}}
  6. {{ end }}
  7. {{ define "main" }}
  8. <form action="{{ .Permalink }}" class="search-form"{{ with .OutputFormats.Get "json" -}} data-json="{{ .Permalink }}"{{- end }}>
  9. <p>
  10. <label>{{ T "search.title" }}</label>
  11. <input name="keyword" placeholder="{{ T `search.placeholder` }}" />
  12. </p>
  13. <button title="{{ T `search.title` }}">
  14. {{ partial "helper/icon" "search" }}
  15. </button>
  16. </form>
  17. <div class="search-result">
  18. <h3 class="search-result--title section-title"></h3>
  19. <div class="search-result--list article-list--compact"></div>
  20. </div>
  21. <script>
  22. window.searchResultTitleTemplate = "{{ T `search.resultTitle` }}"
  23. </script>
  24. {{- $opts := dict "minify" hugo.IsProduction "JSXFactory" "createElement" -}}
  25. {{- $searchScript := resources.Get "ts/search.tsx" | js.Build $opts -}}
  26. <script type="text/javascript" src="{{ $searchScript.RelPermalink }}" defer></script>
  27. {{ partialCached "footer/footer" . }}
  28. {{ end }}