Skip to content

v3.1.0 NuGet Package - IOptions<AlgoliaOptions>

Compare
Choose a tag to compare
@kentico-ericd kentico-ericd released this 09 Aug 18:19
· 31 commits to master since this release
9f95163

This release configures IOptions<AlgoliaOptions> during .NET Core application startup to enable easy settings retrieval in code. For example, to get the ApplicationId and SearchKey for javascript solutions, you can now inject IOptions<AlgoliaOptions> into views:

@using Microsoft.Extensions.Options
@inject IOptions<AlgoliaOptions> options

@{
    var algoliaOptions = options.Value;
}
<script type="text/javascript">
    const search = instantsearch({
      indexName: '@YourSearchModel.IndexName',
      searchClient: algoliasearch('@algoliaOptions.ApplicationId', '@algoliaOptions.SearchKey'),
    });