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.

47 lines
1.6 KiB

4 years ago
  1. +++
  2. title = "Fuzzy Search"
  3. description = "Quickly locate indexed content anywhere on the site."
  4. categories = ["navigation"]
  5. tags = ["links", "search", "controls"]
  6. features = ["code highlighter", "snippets", "related content"]
  7. [[copyright]]
  8. owner = "Josh Habdas"
  9. date = "2019"
  10. license = "agpl-3.0-or-later"
  11. +++
  12. If a search engine can find it, so can you. Quickly locate indexable content site-wide with fuzzy search. No registration necessary.
  13. {{< hackcss-card header="Interactive Example" >}}
  14. <iframe scrolling="no" title="Error Page Example" width="100%" height="300" src="/search/?s=uzzy%20searvh"></iframe>
  15. {{< /hackcss-card >}}
  16. Adjust it from `_index.md` in the site `content/search` directory:
  17. ```
  18. ├── archetypes
  19. ├── content
  20. │ └── search
  21. │ └── _index.md
  22. ├── static
  23. ├── themes
  24. ```
  25. If the file doesn't exist, yet create it:
  26. ```sh
  27. $ hugo new search/_index.md
  28. ```
  29. And specify the `JSON` {{< external href="https://gohugo.io/templates/output-formats" text="Output Format" />}} in site config:
  30. ```toml
  31. [outputs]
  32. home = ["HTML", "RSS", "JSON"]
  33. ```
  34. {{% hackcss-alert type="info" %}}**Note:** This adds `JSON` while keeping the `HTML` and `RSS` defaults.{{% /hackcss-alert %}}
  35. Once activated your site will begin outputting an `index.json` file during generation, giving fuzzy search the data it needs to help you locate pages.
  36. Try it now by navigating to [domain.example/search](/search/), or, if enabled, `Search` in the [Section Menu](../section-menu/), entering a query and navigating between results using <kbd>Tab</kbd>.