Due to algolia record size limit, we need to chunk our post to reduce index record size.
- Build your hugo site, e.g.
~/blog
- In your hugo config, e.g.
~/blog/config.toml
, set like this:Note APIKey should be accessible to write Algolia index.[params] algoliaAppId = "*****" algoliaApiKey = "**********" algoliaIndexName = "****"
- Write some posts, e.g.
~/blog/content/history/a.md
, herehistory
is a section. - Run following golang code
package main import "github.com/yinyajun/hugo_algolia_search" func main() { search.Root = "~/blog" search.BuildIndex("history") }