Content
Content of “index.json” at Algolia as data.frame.
Using environment variables is necessary if continious integration services (e.g. Travis, Appveyor or GitLab CI). In this case you need to specify: - algolia_app_id
: application id - algolia_api_key
: api key with sufficient rights (created in Algolia dashboard) - algolia_index_name
: index name (created in Algolia dashboard)
All three are defined / created in the Algolia dashboard.
Sys.setenv(algolia_app_id = "your_algolia_application_id",
algolia_api_key = "your_algolia_api_key",
algolia_index_name = "your_algolia_index_name")
Finally only one parameter is not not explicitly defined yet. It is the path to to index.json
that should be uploaded to Algolia. We use the Algolia search in tandem with the Hugo theme Academic. Thus the default value is public/index.json
, which usually is the standard deploy location after generating
the website with blogdown::build_site()
.
In this case there is no need to call the algolia::create_config()
function explicitly to upload the index.json
to Algolia using the function algoliar::algolia_post_batch()
.
## Upload new index.json to algolia, no need to call algoliar::create_config()
algoliar::algolia_post_batch()
In cases where this default is not correct only the path_index_json
needs to be set to the correct path/url as shown below:
## Upload new index.json to algolia, calling algoliar::create_config() required!
algoliar::algolia_post_batch(algoliar::create_config("mypath/index.json"))
Using the R package algoliar now automates the formerly manual workflow, which is described in detail in the documentation of the Hugo theme Academic.