Hero Image of content
essays Uploading Data to Algolia Search

The theme recommends using the Algolia CLI to upload data to Algolia.

The data upload requires using the algolia objects command, which expects the uploaded file to be in ndjson format. By default, Hugo doesn’t generate ndjson format data files. However, this theme supports generating ndjson format data files by default, making it convenient to use the algolia objects command to upload data to Algolia.

First, make sure you have installed the Algolia CLI.

Steps

  1. Execute the following command in the root directory of your site:
hugo
  1. Then, locate the algolia.ndjson file in the public directory and upload it to Algolia.
algolia objects import 'your_index_name' -F ./public/algolia.ndjson -p 'your_prifile_name'

Further Reading

  1. Algolia CLI Official Documentation .

  2. For details on generating ndjson files in Hugo, you can refer to the article How to output ndjson format files directly in Hugo and upload to Algolia .