2020-05-05T20:12:01+00:00

Finally got atomic algolia to work in CICD for my hugo blog. I've tried tackling this in many ways over time, but this finally just worked with plug and play ease thanks to just adding a line to the hugo build netlify.toml file.

If you want to try this out, assuming you've already got an algolia index, json file generated and all... then just:

  1. Setup env variables in netlify build
  2. Add the following line to your netlify production build script
echo "Starting atomic-algolia update"
npm run algolia

You should get the following output from your netlify build if everything went right. No hits to algolia if you didn't change your indexes! 🎉

3:13:47 PM: > sheldonhull.hugo@1.0.0 algolia /opt/build/repo
3:13:47 PM: > atomic-algolia
3:13:47 PM: [Algolia] Adding 0 hits to sheldonhull.com
3:13:47 PM: [Algolia] Updating 0 hits to sheldonhull.com
3:13:47 PM: [Algolia] Removing 0 hits from sheldonhull.com
3:13:47 PM: [Algolia] 156 hits unchanged in sheldonhull.com