Open mattstratton opened 7 years ago
For reference, this has gotten slightly easier
https://blog.jeremylikness.com/blog/dynamic-search-in-a-static-hugo-website/
Developer for LifeAdd dynamic search to a static Hugo website with custom templates to generate JSON and JavaScript to parse the results.
I think this actually just gets handled with some documentation - I did this on the Arrested DevOps podcast and I'm 99% sure I did it all outside the theme.
At the moment this can be accomplished simply via creating pages (nothing special in the theme) but making it documented (and having an example / template for it) is a good idea!
For reference, here's the things needed:
in your config.toml
need:
[outputs]
home = ["HTML", "RSS", "JSON"]
page = ["HTML", "RSS"]
layouts/shortcodes
directory, doesn't need to be in the theme)static/js
like this https://github.com/arresteddevops/ado-hugo/blob/main/static/js/search.js
This will likely use google custom search; will require some work on the user side and then tweak some config parameters.
Commenting out the search box until this is done.