Add Algolia search provider (#1531)
* Support Lunr and Algolia search providers * Document search providers and configuration * Update CHANGELOG and history close #1416
This commit is contained in:
@@ -57,6 +57,12 @@ atom_feed:
|
||||
|
||||
search : true # true, false (default)
|
||||
search_full_content : true # true, false (default)
|
||||
search_provider : lunr # lunr (default), algolia
|
||||
algolia:
|
||||
application_id : # YOUR_APPLICATION_ID
|
||||
index_name : # YOUR_INDEX_NAME
|
||||
search_only_api_key : # YOUR_SEARCH_ONLY_API_KEY
|
||||
powered_by : # true (default), false
|
||||
|
||||
# SEO Related
|
||||
google_site_verification : "UQj93ERU9zgECodaaXgVpkjrFn9UrDMEzVamacSoQ8Y" # Replace this with your ID, or delete
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: "Configuration"
|
||||
permalink: /docs/configuration/
|
||||
excerpt: "Settings for configuring and customizing the theme."
|
||||
last_modified_at: 2018-02-01T14:40:00-05:00
|
||||
last_modified_at: 2018-02-16T12:49:45-05:00
|
||||
toc: true
|
||||
---
|
||||
|
||||
@@ -468,23 +468,68 @@ atom_feed:
|
||||
|
||||
### Site Search
|
||||
|
||||
Enable basic site search powered by [Lunr](https://lunrjs.com/) by adding the following to `_config.yml`:
|
||||
|
||||
```yaml
|
||||
search: true
|
||||
```
|
||||
To enable site-wide search add `search: true` to your `_config.yml`.
|
||||
|
||||

|
||||
|
||||
To index the full content of your documents set `search_full_content` to `true` in `_config.yml`:
|
||||
#### Lunr (default)
|
||||
|
||||
```yaml
|
||||
search_full_content: true
|
||||
```
|
||||
The default search uses [**Lunr**](https://lunrjs.com/) to build a search index of all your documents. This method is 100% compatible with sites hosted on GitHub Pages.
|
||||
|
||||
**Note:** Large amounts of posts will increase the size of the search index, impacting page load performance. Setting `search_full_content` to `false` (the default) restricts indexing to the first 50 words of body content.
|
||||
**Note:** Only the first 50 words of a post or page's body content is added to the Lunr search index. Setting `search_full_content` to `true` in your `_config.yml` will override this and could impact page load performance.
|
||||
{: .notice--warning}
|
||||
|
||||
#### Algolia
|
||||
|
||||
For faster and more relevant search ([see demo](https://mmistakes.github.io/jekyll-theme-basically-basic-algolia-search/)):
|
||||
|
||||
1. Add the [`jekyll-algolia`](https://github.com/algolia/jekyll-algolia) gem to your `Gemfile`, in the `:jekyll_plugins` section.
|
||||
|
||||
```ruby
|
||||
group :jekyll_plugins do
|
||||
gem "jekyll-feed"
|
||||
gem "jekyll-seo-tag"
|
||||
gem "jekyll-sitemap"
|
||||
gem "jekyll-paginate"
|
||||
gem "jekyll-algolia"
|
||||
end
|
||||
```
|
||||
|
||||
Once this is done, download all dependencies by running `bundle install`.
|
||||
|
||||
2. Switch search providers from `lunr` to `algolia` in your `_config.yml` file:
|
||||
|
||||
```yaml
|
||||
search_provider: algolia
|
||||
```
|
||||
|
||||
3. Add the following Algolia credentials to your `_config.yml` file. *If you don't have an Algolia account, you can open a free [Community plan](https://www.algolia.com/users/sign_up/hacker). Once signed in, you can grab your credentials from [your dashboard](https://www.algolia.com/licensing).*
|
||||
|
||||
```yaml
|
||||
algolia:
|
||||
application_id: # YOUR_APPLICATION_ID
|
||||
index_name: # YOUR_INDEX_NAME
|
||||
search_only_api_key: # YOUR_SEARCH_ONLY_API_KEY
|
||||
powered_by: # true (default), false
|
||||
```
|
||||
|
||||
4. Once your credentials are setup, you can run the indexing with the following command:
|
||||
|
||||
```
|
||||
ALGOLIA_API_KEY=your_admin_api_key bundle exec jekyll algolia
|
||||
```
|
||||
|
||||
For Windows users you will have to use `set` to assigned the `ALGOLIA_API_KEY` environment variable.
|
||||
|
||||
```
|
||||
set ALGOLIA_API_KEY=your_admin_api_key
|
||||
bundle exec jekyll algolia
|
||||
```
|
||||
|
||||
Note that `ALGOLIA_API_KEY` should be set to your admin API key.
|
||||
|
||||
To use the Algolia search with GitHub Pages hosted sites follow [this deployment guide](https://community.algolia.com/jekyll-algolia/github-pages.html). Or this guide for [deploying on Netlify](https://community.algolia.com/jekyll-algolia/netlify.html).
|
||||
|
||||
### SEO, Social Sharing, and Analytics Settings
|
||||
|
||||
All optional, but a good idea to take the time setting up to improve SEO and links shared from the site.
|
||||
|
||||
@@ -4,10 +4,16 @@ permalink: /docs/history/
|
||||
excerpt: "Change log of enhancements and bug fixes made to the theme."
|
||||
sidebar:
|
||||
nav: docs
|
||||
last_modified_at: 2018-02-05T14:38:43-05:00
|
||||
last_modified_at: 2018-02-16T12:45:12-05:00
|
||||
toc: true
|
||||
---
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Enhancements
|
||||
|
||||
* Add support for [Algolia](https://www.algolia.com/) search provider. [#1416](https://github.com/mmistakes/minimal-mistakes/issues/1416)
|
||||
|
||||
## [4.9.1](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.9.1)
|
||||
|
||||
### Enhancements
|
||||
|
||||
Reference in New Issue
Block a user