algoliasearch-jekyll 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -301
- data/Rakefile +12 -7
- data/algoliasearch-jekyll.gemspec +6 -5
- data/lib/version.rb +1 -1
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6047d13e0009e3118aa3f92185f4bb75834b30a
|
4
|
+
data.tar.gz: 9699b92d23a09417e85c436949bba0efd183c9f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c21136d528d777aea77bbc62ce0e6ffb92b19ca0a6fa4c090664021814a7d9d61d5796819017fdbcdc582d6c4f96126b5af21afdc4bc8956ffba6926eb9dcbec
|
7
|
+
data.tar.gz: 46e1225115b202bf4bd110456f219aeb03104853e8b7a358c8bd5a0d38087e1fdbff9c6da74305e649d769c2387eef43ef754e79f7f1e193f639f94c38f01aca
|
data/README.md
CHANGED
@@ -1,307 +1,17 @@
|
|
1
|
-
# Algolia Jekyll Plugin
|
1
|
+
# Algolia Jekyll Plugin
|
2
2
|
|
3
|
-
|
4
|
-
[![Build Status][2]](https://travis-ci.org/algolia/algoliasearch-jekyll)
|
5
|
-
[![Coverage Status][3]](https://coveralls.io/github/algolia/algoliasearch-jekyll?branch=master)
|
6
|
-
[![Code Climate][4]](https://codeclimate.com/github/algolia/algoliasearch-jekyll)
|
7
|
-
![Jekyll >= 2.5](https://img.shields.io/badge/jekyll-%3E%3D%202.5-green.svg)
|
3
|
+
## ⚠ DEPRECATION NOTICE
|
8
4
|
|
9
|
-
|
10
|
-
Algolia index by simply running `jekyll algolia push`.
|
5
|
+
This gem has been deprecated in favor of [jekyll-algolia][1].
|
11
6
|
|
12
|
-
|
7
|
+
No further development will be happening on that gem.
|
13
8
|
|
14
|
-
|
15
|
-
|
16
|
-
```
|
9
|
+
We strongly encourage you to try the new gem. It is officially supported by
|
10
|
+
Algolia and you can find its [complete documentation][2] online.
|
17
11
|
|
18
|
-
|
12
|
+
<<<<<<< 2ecd95dcf20550d3e43282c6c3e7158130ec2e3d
|
13
|
+
=======
|
19
14
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
## Installation
|
24
|
-
|
25
|
-
First, add the `algoliasearch-jekyll` gem to your `Gemfile`, in the
|
26
|
-
`:jekyll_plugins` section. If you do not yet have a `Gemfile`, here is the
|
27
|
-
minimum content to get your started.
|
28
|
-
|
29
|
-
```ruby
|
30
|
-
source 'https://rubygems.org'
|
31
|
-
|
32
|
-
gem 'jekyll', '~> 2.5.3'
|
33
|
-
|
34
|
-
group :jekyll_plugins do
|
35
|
-
gem 'algoliasearch-jekyll', '~> 0.9.0'
|
36
|
-
end
|
37
|
-
```
|
38
|
-
|
39
|
-
Once this is done, download all dependencies with `bundle install`.
|
40
|
-
|
41
|
-
Then, add `algoliasearch-jekyll` to your `_config.yml` file, under the `gems`
|
42
|
-
section, like this:
|
43
|
-
|
44
|
-
```yaml
|
45
|
-
plugins:
|
46
|
-
- algoliasearch-jekyll
|
47
|
-
```
|
48
|
-
|
49
|
-
If everything went well, you should be able to execute `jekyll help` and see the
|
50
|
-
`algolia` subcommand listed.
|
51
|
-
|
52
|
-
## Configuration
|
53
|
-
|
54
|
-
Add information about your Algolia configuration into the `_config.yml` file,
|
55
|
-
under the `algolia` section, like this:
|
56
|
-
|
57
|
-
```yaml
|
58
|
-
algolia:
|
59
|
-
application_id: 'your_application_id'
|
60
|
-
index_name: 'your_index_name'
|
61
|
-
```
|
62
|
-
|
63
|
-
You can also define the `ALGOLIA_APPLICATION_ID` and `ALGOLIA_INDEX_NAME`
|
64
|
-
environment variables. If present, they will be used instead of the options in
|
65
|
-
`_config.yml`.
|
66
|
-
|
67
|
-
Your write api key will be read from the `ALGOLIA_API_KEY` environment variable.
|
68
|
-
You can define it on the same line as your command, allowing you to type
|
69
|
-
`ALGOLIA_API_KEY='your_write_api_key' jekyll algolia push`.
|
70
|
-
|
71
|
-
Note that your API key should have write access to both the `index_name` and
|
72
|
-
`_tmp` suffixed version of it (eg. `your_index_name` and `your_index_name_tmp`)
|
73
|
-
in the previous example). This is due to the way we do atomic pushes by pushing
|
74
|
-
to a temporary index and then renaming it. The easiest way is to create a key
|
75
|
-
with access to in the `index_name*` index (note the `*` suffix).
|
76
|
-
|
77
|
-
### ⚠ Other, unsecure, method ⚠
|
78
|
-
|
79
|
-
You can also store your write api key in a file named `_algolia_api_key`, in
|
80
|
-
your source directory. If you do this we __very, very, very strongly__ encourage
|
81
|
-
you to make sure the file is not tracked in your versioning system.
|
82
|
-
|
83
|
-
### Options
|
84
|
-
|
85
|
-
The plugin uses sensible defaults, but you may want to override some of its
|
86
|
-
configuration. Here are the various options you can add to your `_config.yml`
|
87
|
-
file, under the `algolia` section:
|
88
|
-
|
89
|
-
#### `excluded_files`
|
90
|
-
|
91
|
-
Defines which files should not be indexed for search.
|
92
|
-
|
93
|
-
```yml
|
94
|
-
algolia:
|
95
|
-
excluded_files:
|
96
|
-
- index.html
|
97
|
-
- 2015-01-01-post.md
|
98
|
-
```
|
99
|
-
|
100
|
-
#### `record_css_selector`
|
101
|
-
|
102
|
-
Defines the css selector inside a page/post used to choose which parts to index.
|
103
|
-
It is set to all paragraphs (`<p>`) by default.
|
104
|
-
|
105
|
-
If you would like to also index lists, you could set it like this:
|
106
|
-
|
107
|
-
```yml
|
108
|
-
algolia:
|
109
|
-
record_css_selector: 'p,ul'
|
110
|
-
```
|
111
|
-
|
112
|
-
#### `allowed_extensions`
|
113
|
-
|
114
|
-
Define additional extensions to be indexed. The default behaviour is to index
|
115
|
-
only markdown and HTML files.
|
116
|
-
|
117
|
-
```yml
|
118
|
-
algolia:
|
119
|
-
allowed_extensions:
|
120
|
-
- adoc
|
121
|
-
- ad
|
122
|
-
```
|
123
|
-
|
124
|
-
#### `settings`
|
125
|
-
|
126
|
-
Here you can pass any specific [index settings][5] to your Algolia index. All
|
127
|
-
the settings supported by the API can be passed here.
|
128
|
-
|
129
|
-
##### Examples
|
130
|
-
|
131
|
-
If you want to activate `distinct` and some snippets for example, you would do:
|
132
|
-
|
133
|
-
```yml
|
134
|
-
algolia:
|
135
|
-
settings:
|
136
|
-
attributeForDistinct: 'hierarchy'
|
137
|
-
distinct: true
|
138
|
-
attributesToSnippet: ['text:20']
|
139
|
-
```
|
140
|
-
|
141
|
-
If you want to search in other fields than the default ones, you'll have to edit
|
142
|
-
the `attributesToIndex` (default is `%w(title h1 h2 h3 h4 h5 h6 unordered(text)
|
143
|
-
unordered(tags))`
|
144
|
-
|
145
|
-
```yml
|
146
|
-
algolia:
|
147
|
-
settings:
|
148
|
-
attributesToIndex:
|
149
|
-
- title
|
150
|
-
- h1
|
151
|
-
- h2
|
152
|
-
- h3
|
153
|
-
- h4
|
154
|
-
- h5
|
155
|
-
- h6
|
156
|
-
- unordered(text)
|
157
|
-
- unordered(tags)
|
158
|
-
- your_custom_attribute_1
|
159
|
-
- your_custom_attribute_2
|
160
|
-
- ...
|
161
|
-
```
|
162
|
-
|
163
|
-
### Hooks
|
164
|
-
|
165
|
-
The `AlgoliaSearchRecordExtractor` contains two methods (`custom_hook_each` and
|
166
|
-
`custom_hook_all`) that are here so you can overwrite them to add your custom
|
167
|
-
logic. They currently simply return the argument they take as input.
|
168
|
-
|
169
|
-
The best way to override them is to create a `./_plugins/search.rb` file, with
|
170
|
-
the following content:
|
171
|
-
|
172
|
-
```ruby
|
173
|
-
class AlgoliaSearchRecordExtractor
|
174
|
-
# Hook to modify a record after extracting
|
175
|
-
def custom_hook_each(item, node)
|
176
|
-
# `node` is a Nokogiri HTML node, so you can access its type through `node.name`
|
177
|
-
# or its classname through `node.attr('class')` for example
|
178
|
-
|
179
|
-
# Just return `nil` instead of `item` if you want to discard this record
|
180
|
-
item
|
181
|
-
end
|
182
|
-
|
183
|
-
# Hook to modify all records after extracting
|
184
|
-
def custom_hook_all(items)
|
185
|
-
items
|
186
|
-
end
|
187
|
-
end
|
188
|
-
```
|
189
|
-
|
190
|
-
The `AlgoliaSearchJekyllPush` class also lets user define the
|
191
|
-
`custom_hook_excluded_file?` method. This method is called on every file that
|
192
|
-
the plugin thinks it should parse and index. If it returns `true`, the file is
|
193
|
-
not indexed. You can add here your custom logic to exclude some files.
|
194
|
-
|
195
|
-
```ruby
|
196
|
-
class AlgoliaSearchJekyllPush < Jekyll::Command
|
197
|
-
class << self
|
198
|
-
# Hook to exclude some files from indexing
|
199
|
-
def custom_hook_excluded_file?(file)
|
200
|
-
return true if file.path =~ %r{^/excluded_dir/}
|
201
|
-
false
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
```
|
206
|
-
|
207
|
-
## Command line
|
208
|
-
|
209
|
-
Here is the list of command line options you can pass to the `jekyll algolia
|
210
|
-
push` command:
|
211
|
-
|
212
|
-
| Flag | Description |
|
213
|
-
| ---- | ----- |
|
214
|
-
| `--config ./_config.yml` | You can here specify the config file to use. Default is `_config.yml` |
|
215
|
-
| `--future` | With this flag, the command will also index posts with a future date |
|
216
|
-
| `--limit_posts 10` | Limits the number of posts to parse and index |
|
217
|
-
| `--drafts` | Index drafts in the `_drafts` folder as well |
|
218
|
-
| `--dry-run` or `-n` | Do a dry run, do not actually push anything to your index |
|
219
|
-
| `--verbose` | Display more information about what is going to be indexed |
|
220
|
-
|
221
|
-
## Dependencies
|
222
|
-
|
223
|
-
The `algoliasearch-jekyll` plugin works for versions of Jekyll starting from
|
224
|
-
2.5, with a version of Ruby of at least 2.0. You also need
|
225
|
-
[Bundler][6] to easily add the gem as a dependency to Jekyll.
|
226
|
-
|
227
|
-
## Searching
|
228
|
-
|
229
|
-
This plugin will only index your data in your Algolia index. Adding search
|
230
|
-
capabilities is quite easy. You can follow [our tutorials][7] or use our forked
|
231
|
-
version of the popular [Hyde theme][8].
|
232
|
-
|
233
|
-
## GitHub Pages
|
234
|
-
|
235
|
-
GitHub does not allow custom plugins to be run on GitHub Pages. This means that
|
236
|
-
you'll either have to run `bundle exec jekyll algolia push` manually, or
|
237
|
-
configure TravisCI to do it for you.
|
238
|
-
|
239
|
-
[Travis CI][9] is an hosted continuous integration
|
240
|
-
service, and it's free for open-source projects. Properly configured, it can
|
241
|
-
automatically reindex your data whenever you push to `gh-pages`.
|
242
|
-
|
243
|
-
For it to work, you'll have 3 steps to perform.
|
244
|
-
|
245
|
-
### 1. Create a `.travis.yml` file
|
246
|
-
|
247
|
-
Create a file named `.travis.yml` at the root of your project, with the
|
248
|
-
following content:
|
249
|
-
|
250
|
-
```yml
|
251
|
-
language: ruby
|
252
|
-
cache: bundler
|
253
|
-
branches:
|
254
|
-
only:
|
255
|
-
- gh-pages
|
256
|
-
script:
|
257
|
-
- bundle exec jekyll algolia push
|
258
|
-
rvm:
|
259
|
-
- 2.2
|
260
|
-
```
|
261
|
-
|
262
|
-
This file will be read by Travis and instruct it to fetch all dependencies
|
263
|
-
defined in the `Gemfile`, then run `jekyll algolia push`. This will only be
|
264
|
-
triggered when data is pushed to the `gh-pages` branch.
|
265
|
-
|
266
|
-
### 2. Update your `_config.yml` file to exclude `vendor`
|
267
|
-
|
268
|
-
Travis will download all you `Gemfile` dependencies into a directory named
|
269
|
-
`vendor`. You have to tell Jekyll to ignore this directory, otherwise Jekyll
|
270
|
-
will try to parse it (and fail).
|
271
|
-
|
272
|
-
Doing so is easy, just add the following line to your `_config.yml` file:
|
273
|
-
|
274
|
-
```yml
|
275
|
-
exclude: [vendor]
|
276
|
-
```
|
277
|
-
|
278
|
-
### 3. Configure Travis
|
279
|
-
|
280
|
-
In order for Travis to be able to push data to your index on your behalf, you
|
281
|
-
have to give it your write API Key. This is achieved by defining an
|
282
|
-
`ALGOLIA_API_KEY` [environment variable][10] in Travis settings.
|
283
|
-
|
284
|
-
You should also uncheck the "Build pull requests" option, otherwise any pull
|
285
|
-
request targeting `gh-pages` will trigger the reindexing.
|
286
|
-
|
287
|
-
![Travis Configuration][11]
|
288
|
-
|
289
|
-
### Done
|
290
|
-
|
291
|
-
Commit all the changes to the files, and then push to `gh-pages`. Travis will
|
292
|
-
catch the event and trigger your indexing for you. You can follow the Travis job
|
293
|
-
execution directly on [their website][12].
|
294
|
-
|
295
|
-
|
296
|
-
[1]: https://badge.fury.io/rb/algoliasearch-jekyll.svg
|
297
|
-
[2]: https://travis-ci.org/algolia/algoliasearch-jekyll.svg?branch=master
|
298
|
-
[3]: https://coveralls.io/repos/algolia/algoliasearch-jekyll/badge.svg?branch=master&service=github
|
299
|
-
[4]: https://codeclimate.com/github/algolia/algoliasearch-jekyll/badges/gpa.svg
|
300
|
-
[5]: https://www.algolia.com/doc/ruby#indexing-parameters
|
301
|
-
[6]: http://bundler.io/
|
302
|
-
[7]: https://www.algolia.com/doc/javascript
|
303
|
-
[8]: https://github.com/algolia/hyde
|
304
|
-
[9]: https://travis-ci.org/
|
305
|
-
[10]: http://docs.travis-ci.com/user/environment-variables/
|
306
|
-
[11]: /docs/travis-settings.png
|
307
|
-
[12]: https://travis-ci.org
|
15
|
+
>>>>>>> Adding deprecation notice in the readme
|
16
|
+
[1]: https://github.com/algolia/jekyll-algolia
|
17
|
+
[2]: https://community.algolia.com/jekyll-algolia/getting-started.html
|
data/Rakefile
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'rubygems'
|
4
2
|
require 'bundler'
|
5
3
|
begin
|
6
4
|
Bundler.setup(:default, :development)
|
7
5
|
rescue Bundler::BundlerError => e
|
8
|
-
|
9
|
-
|
6
|
+
warn e.message
|
7
|
+
warn 'Run `bundle install` to install missing gems'
|
10
8
|
exit e.status_code
|
11
9
|
end
|
12
10
|
require 'rake'
|
@@ -20,11 +18,18 @@ Jeweler::Tasks.new do |gem|
|
|
20
18
|
gem.version = AlgoliaSearchJekyllVersion.to_s
|
21
19
|
gem.homepage = 'https://github.com/algolia/algoliasearch-jekyll'
|
22
20
|
gem.license = 'MIT'
|
23
|
-
gem.summary = '
|
24
|
-
gem.description = '
|
25
|
-
'`jekyll algolia push`'
|
21
|
+
gem.summary = '[⚠ DEPRECATED ⚠]: Use jekyll-algolia instead'.freeze
|
22
|
+
gem.description = '[⚠ DEPRECATED ⚠]: Use jekyll-algolia instead'.freeze
|
26
23
|
gem.email = 'tim@pixelastic.com'
|
27
24
|
gem.authors = ['Tim Carry']
|
25
|
+
gem.post_install_message = <<-MESSAGE
|
26
|
+
! The 'algolisearch-jekyll' gem has been deprecated and has been replaced with 'jekyll-algolia'.
|
27
|
+
! See: https://rubygems.org/gems/jekyll-algolia
|
28
|
+
! And: https://github.com/algolia/jekyll-algolia
|
29
|
+
!
|
30
|
+
! You can get quickly started on the new plugin using this documentation:
|
31
|
+
! https://community.algolia.com/jekyll-algolia/getting-started.html
|
32
|
+
MESSAGE
|
28
33
|
|
29
34
|
# dependencies defined in Gemfile
|
30
35
|
end
|
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: algoliasearch-jekyll 0.9.
|
5
|
+
# stub: algoliasearch-jekyll 0.9.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "algoliasearch-jekyll".freeze
|
9
|
-
s.version = "0.9.
|
9
|
+
s.version = "0.9.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Tim Carry".freeze]
|
14
|
-
s.date = "2017-
|
15
|
-
s.description = "
|
14
|
+
s.date = "2017-12-21"
|
15
|
+
s.description = "[\u26A0 DEPRECATED \u26A0]: Use jekyll-algolia instead".freeze
|
16
16
|
s.email = "tim@pixelastic.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE.txt",
|
@@ -100,8 +100,9 @@ Gem::Specification.new do |s|
|
|
100
100
|
]
|
101
101
|
s.homepage = "https://github.com/algolia/algoliasearch-jekyll".freeze
|
102
102
|
s.licenses = ["MIT".freeze]
|
103
|
+
s.post_install_message = " ! The 'algolisearch-jekyll' gem has been deprecated and has been replaced with 'jekyll-algolia'.\n ! See: https://rubygems.org/gems/jekyll-algolia\n ! And: https://github.com/algolia/jekyll-algolia\n !\n ! You can get quickly started on the new plugin using this documentation:\n ! https://community.algolia.com/jekyll-algolia/getting-started.html\n".freeze
|
103
104
|
s.rubygems_version = "2.6.13".freeze
|
104
|
-
s.summary = "
|
105
|
+
s.summary = "[\u26A0 DEPRECATED \u26A0]: Use jekyll-algolia instead".freeze
|
105
106
|
|
106
107
|
if s.respond_to? :specification_version then
|
107
108
|
s.specification_version = 4
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: algoliasearch-jekyll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Carry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: algoliasearch
|
@@ -240,8 +240,7 @@ dependencies:
|
|
240
240
|
- - "<"
|
241
241
|
- !ruby/object:Gem::Version
|
242
242
|
version: '2'
|
243
|
-
description:
|
244
|
-
push`
|
243
|
+
description: "[⚠ DEPRECATED ⚠]: Use jekyll-algolia instead"
|
245
244
|
email: tim@pixelastic.com
|
246
245
|
executables: []
|
247
246
|
extensions: []
|
@@ -331,7 +330,13 @@ homepage: https://github.com/algolia/algoliasearch-jekyll
|
|
331
330
|
licenses:
|
332
331
|
- MIT
|
333
332
|
metadata: {}
|
334
|
-
post_install_message:
|
333
|
+
post_install_message: |2
|
334
|
+
! The 'algolisearch-jekyll' gem has been deprecated and has been replaced with 'jekyll-algolia'.
|
335
|
+
! See: https://rubygems.org/gems/jekyll-algolia
|
336
|
+
! And: https://github.com/algolia/jekyll-algolia
|
337
|
+
!
|
338
|
+
! You can get quickly started on the new plugin using this documentation:
|
339
|
+
! https://community.algolia.com/jekyll-algolia/getting-started.html
|
335
340
|
rdoc_options: []
|
336
341
|
require_paths:
|
337
342
|
- lib
|
@@ -350,5 +355,5 @@ rubyforge_project:
|
|
350
355
|
rubygems_version: 2.6.13
|
351
356
|
signing_key:
|
352
357
|
specification_version: 4
|
353
|
-
summary:
|
358
|
+
summary: "[⚠ DEPRECATED ⚠]: Use jekyll-algolia instead"
|
354
359
|
test_files: []
|