v3.1.0 NuGet Package - IOptions<AlgoliaOptions>
kentico-ericd
released this
09 Aug 18:19
·
31 commits
to master
since this release
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'),
});