create_config: Create Algolia Configuration

Description Usage Arguments Value See Also Examples

View source: R/algolia.R

Description

Create Algolia Configuration

Usage

1
2
3
4
create_config(path_index_json = "public/index.json",
  app_id = Sys.getenv("algolia_app_id"),
  api_key = Sys.getenv("algolia_api_key"),
  index_name = Sys.getenv("algolia_index_name"))

Arguments

path_index_json

path to index.json (default: "public/index.json")

app_id

app_id Application ID. This is your unique application identifier. It's used to identify you when using Algolia's API. (see: create a API key with valid scope in the Algolia Dashboard), (default: Sys.getenv("algolia_app_id"))

api_key

api_key (default: Sys.getenv("algolia_api_key"), <https://www.algolia.com/doc/api-client/methods/api-keys/>

index_name

name of Algolia index name (default: Sys.getenv("algolia_index_name"))

Value

list with algolia config

See Also

<https://www.algolia.com/doc/guides/getting-started/quick-start/tutorials/getting-started-with-the-dashboard/>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## Not run: 
########################################################################
### Option A) Interactive R Session
########################################################################

config <- create_config(path_index_json = "path_to_your_index.json",
                        app_id = "your_algolia_application_id",
                        api_key = "your_algolia_api_key",
                        index_name = "your_algolia_index_name")

########################################################################
### Option B) Environment variable
########################################################################

Sys.setenv(algolia_app_id = "your_algolia_application_id",
           algolia_api_key = "your_algolia_api_key",
           algolia_index_name = "your_algolia_index_name")


### With default path to index.json ("public/index.json")
### (i.e standard output path after running blogdown::build_site() for
### theme hugo-academic (https://github.com/gcushen/hugo-academic/)

config <- create_config()

### With user defined path or url to index.json "public/index.json"

config <- create_config(path_index_json = "https://mhugoacademicsite.de/index.json")


## End(Not run)

KWB-R/algoliar documentation built on Sept. 9, 2019, 3:16 p.m.