jekyll-algolia 1.4.7 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CONTRIBUTING.md +10 -0
- data/README.md +34 -12
- data/lib/errors/no_records_found.txt +1 -1
- data/lib/jekyll-algolia.rb +8 -1
- data/lib/jekyll/algolia/configurator.rb +9 -1
- data/lib/jekyll/algolia/error_handler.rb +1 -0
- data/lib/jekyll/algolia/file_browser.rb +10 -1
- data/lib/jekyll/algolia/indexer.rb +1 -0
- data/lib/jekyll/algolia/logger.rb +1 -0
- data/lib/jekyll/algolia/overwrites/jekyll-algolia-site.rb +1 -5
- data/lib/jekyll/algolia/utils.rb +4 -0
- data/lib/jekyll/algolia/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 057a2f81a44baa0f0408de91f01537b3e158841e4ae9b6106923d57a88f11159
|
4
|
+
data.tar.gz: d3e7d88edd82282fe99d506406d0884aafb48049066638e68cd3f8f3aa0e7cbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fb927d3c90919341f48d49b47aa5e72018c78f1c06241149f868d2c4395bf94ba5a7932ed5769a8873c6d9ac84872e31bf1cfda4a8bb9296765303025534b46
|
7
|
+
data.tar.gz: 2602e67b07d7582517a615b3410dde5ec375e0c1795015adc41f8059b3e6d4261918048056fa6330ac13df75c63d569aa06a5858e3d45cc596cc93348ecd3d36
|
data/CONTRIBUTING.md
CHANGED
@@ -38,6 +38,16 @@ group :jekyll_plugins do
|
|
38
38
|
end
|
39
39
|
```
|
40
40
|
|
41
|
+
## Running integration tests
|
42
|
+
|
43
|
+
Integration tests will do a full jekyll run, and push data to an Algolia index,
|
44
|
+
checking that records and settings are correctly saved. It is the slowest
|
45
|
+
possible kind of tests, but also the one closest to a real implementation.
|
46
|
+
|
47
|
+
Running those tests requires a real Algolia plan. You need to define
|
48
|
+
`ALGOLIA_APPLICATION_ID`, `ALGOLIA_API_KEY` and `ALGOLIA_INDEX_NAME` (we suggest
|
49
|
+
using `direnv` for that), and then run `./scripts/test_integration`.
|
50
|
+
|
41
51
|
## Linting
|
42
52
|
|
43
53
|
Run `rake lint` to check the style of all ruby files. Run `rake
|
data/README.md
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
# Jekyll Algolia Plugin
|
2
2
|
|
3
|
-
[![gem version][1]]
|
3
|
+
[![gem version][1]][16]
|
4
4
|
![ruby][2]
|
5
5
|
![jekyll][3]
|
6
|
-
[![build master][4]]
|
7
|
-
[![
|
8
|
-
[![
|
9
|
-
[![coverage develop][7]](https://coveralls.io/github/algolia/jekyll-algolia?branch=develop)
|
6
|
+
[![build master][4]][17]
|
7
|
+
[![build develop][6]][17]
|
8
|
+
[![coverage master][5]][18]
|
10
9
|
|
11
10
|
Add fast and relevant search to your Jekyll site.
|
12
11
|
|
@@ -21,7 +20,7 @@ This will push the content of your Jekyll website to your Algolia index.
|
|
21
20
|
## Documentation
|
22
21
|
|
23
22
|
Full documentation can be found on
|
24
|
-
[https://community.algolia.com/jekyll-algolia/]
|
23
|
+
[https://community.algolia.com/jekyll-algolia/][20]
|
25
24
|
|
26
25
|
## Installation
|
27
26
|
|
@@ -42,12 +41,12 @@ Once this is done, download all dependencies with `bundle install`.
|
|
42
41
|
|
43
42
|
## Basic configuration
|
44
43
|
|
45
|
-
You need to provide certain Algolia credentials for this plugin to
|
44
|
+
You need to provide certain Algolia credentials for this plugin to _index_ your
|
46
45
|
site.
|
47
46
|
|
48
|
-
|
47
|
+
_If you don't yet have an Algolia account, we suggest that you open a free
|
49
48
|
[Community plan here][8]. You can find more information about the Algolia plans
|
50
|
-
[in our FAQ][10]
|
49
|
+
[in our FAQ][10]._
|
51
50
|
|
52
51
|
Once signed in, you should get your application ID from [your dashboard][9] and
|
53
52
|
define it inside your `_config.yml` file like this:
|
@@ -89,19 +88,42 @@ FAQ][10].
|
|
89
88
|
Thanks to [Anatoliy Yastreb][14] for a [great tutorial][15] on creating Jekyll
|
90
89
|
plugins.
|
91
90
|
|
92
|
-
|
93
91
|
[1]: https://badge.fury.io/rb/jekyll-algolia.svg
|
92
|
+
|
94
93
|
[2]: https://img.shields.io/badge/ruby-%3E%3D%202.3.0-green.svg
|
94
|
+
|
95
95
|
[3]: https://img.shields.io/badge/jekyll-%3E%3D%203.6.0-green.svg
|
96
|
+
|
96
97
|
[4]: https://img.shields.io/badge/dynamic/json.svg?label=build%3Amaster&query=value&uri=https%3A%2F%2Fimg.shields.io%2Ftravis%2Falgolia%2Fjekyll-algolia.json%3Fbranch%3Dmaster
|
97
|
-
|
98
|
+
|
99
|
+
[5]: https://coveralls.io/repos/github/algolia/jekyll-algolia/badge.svg?branch=master
|
100
|
+
|
98
101
|
[6]: https://img.shields.io/badge/dynamic/json.svg?label=build%3Adevelop&query=value&uri=https%3A%2F%2Fimg.shields.io%2Ftravis%2Falgolia%2Fjekyll-algolia.json%3Fbranch%3Ddevelop
|
99
|
-
|
102
|
+
|
103
|
+
[7]: https://coveralls.io/repos/github/algolia/jekyll-algolia/badge.svg?branch=develop
|
104
|
+
|
100
105
|
[8]: #more-about-the-community-plan
|
106
|
+
|
101
107
|
[9]: https://www.algolia.com/api-keys
|
108
|
+
|
102
109
|
[10]: https://community.algolia.com/jekyll-algolia/faq.html#how-many-records-will-the-plugin-need
|
110
|
+
|
103
111
|
[11]: https://www.algolia.com/users/sign_up/hacker
|
112
|
+
|
104
113
|
[12]: https://community.algolia.com/instantsearch.js/
|
114
|
+
|
105
115
|
[13]: https://www.algolia.com/press#resources
|
116
|
+
|
106
117
|
[14]: https://github.com/ayastreb/
|
118
|
+
|
107
119
|
[15]: https://ayastreb.me/writing-a-jekyll-plugin/
|
120
|
+
|
121
|
+
[16]: https://rubygems.org/gems/jekyll-algolia
|
122
|
+
|
123
|
+
[17]: https://travis-ci.org/algolia/jekyll-algolia
|
124
|
+
|
125
|
+
[18]: https://coveralls.io/github/algolia/jekyll-algolia?branch=master
|
126
|
+
|
127
|
+
[19]: https://coveralls.io/github/algolia/jekyll-algolia?branch=develop
|
128
|
+
|
129
|
+
[20]: https://community.algolia.com/jekyll-algolia/getting-started.html
|
@@ -1,6 +1,6 @@
|
|
1
1
|
E:[✗ Error] No records found
|
2
2
|
E:
|
3
|
-
E:The jekyll-algolia plugin could find any records to index
|
3
|
+
E:The jekyll-algolia plugin could not find any records to index.
|
4
4
|
W:
|
5
5
|
W:The plugin tried to extract records from the pages, posts and collections of your site but could not find anything to index.
|
6
6
|
I:
|
data/lib/jekyll-algolia.rb
CHANGED
@@ -19,6 +19,8 @@ module Jekyll
|
|
19
19
|
require 'jekyll/algolia/utils'
|
20
20
|
require 'jekyll/algolia/version'
|
21
21
|
|
22
|
+
MissingCredentialsError = Class.new(StandardError)
|
23
|
+
|
22
24
|
# Public: Init the Algolia module
|
23
25
|
#
|
24
26
|
# config - A hash of Jekyll config option (merge of _config.yml options and
|
@@ -33,7 +35,12 @@ module Jekyll
|
|
33
35
|
config = Configurator.init(config).config
|
34
36
|
@site = Jekyll::Algolia::Site.new(config)
|
35
37
|
|
36
|
-
|
38
|
+
unless Configurator.assert_valid_credentials
|
39
|
+
raise(
|
40
|
+
MissingCredentialsError,
|
41
|
+
"One or more credentials were not found for site at: #{@site.source}"
|
42
|
+
)
|
43
|
+
end
|
37
44
|
|
38
45
|
Configurator.warn_of_deprecated_options
|
39
46
|
|
@@ -209,6 +209,7 @@ module Jekyll
|
|
209
209
|
def self.verbose?
|
210
210
|
value = get('verbose')
|
211
211
|
return true if value == true
|
212
|
+
|
212
213
|
false
|
213
214
|
end
|
214
215
|
|
@@ -218,6 +219,7 @@ module Jekyll
|
|
218
219
|
def self.dry_run?
|
219
220
|
value = get('dry_run')
|
220
221
|
return true if value == true
|
222
|
+
|
221
223
|
false
|
222
224
|
end
|
223
225
|
|
@@ -228,6 +230,7 @@ module Jekyll
|
|
228
230
|
def self.force_settings?
|
229
231
|
value = get('force_settings')
|
230
232
|
return true if value == true
|
233
|
+
|
231
234
|
false
|
232
235
|
end
|
233
236
|
|
@@ -238,6 +241,7 @@ module Jekyll
|
|
238
241
|
def self.extensions_to_index
|
239
242
|
extensions = algolia('extensions_to_index')
|
240
243
|
return [] if extensions.nil?
|
244
|
+
|
241
245
|
extensions = extensions.split(',') if extensions.is_a? String
|
242
246
|
extensions
|
243
247
|
end
|
@@ -246,7 +250,7 @@ module Jekyll
|
|
246
250
|
# with the indexing
|
247
251
|
# Note that if other jekyll plugins are defined as part of the
|
248
252
|
# :jekyll_plugins group in the Gemfile, we might be able to override them
|
249
|
-
# using .load_overwrites in
|
253
|
+
# using .load_overwrites in jekyll-algolia.rb.
|
250
254
|
# If they are simply required in Gemfile, then we might need to revert
|
251
255
|
# their values to nil values from here
|
252
256
|
def self.disable_other_plugins(config)
|
@@ -260,6 +264,10 @@ module Jekyll
|
|
260
264
|
config['pagination'] = {} unless config['pagination'].is_a?(Hash)
|
261
265
|
config['pagination']['enabled'] = false
|
262
266
|
|
267
|
+
# Disable autopages for jekyll-paginate-v2
|
268
|
+
config['autopages'] = {} unless config['autopages'].is_a?(Hash)
|
269
|
+
config['autopages']['enabled'] = false
|
270
|
+
|
263
271
|
# Disable tags from jekyll-tagging
|
264
272
|
config['tag_page_dir'] = nil
|
265
273
|
config['tag_page_layout'] = nil
|
@@ -90,7 +90,15 @@ module Jekyll
|
|
90
90
|
# an HTML meta refresh. We need to exclude those files from indexing.
|
91
91
|
# https://github.com/jekyll/jekyll-redirect-from
|
92
92
|
def self.redirect?(file)
|
93
|
-
|
93
|
+
# When using redirect_from, jekyll-redirect-from creates a page named
|
94
|
+
# `redirect.html`
|
95
|
+
return true if file.respond_to?(:name) && file.name == 'redirect.html'
|
96
|
+
# When using redirect_to, it sets the layout to `redirect`
|
97
|
+
if file.respond_to?(:data) && file.data['layout'] == 'redirect'
|
98
|
+
return true
|
99
|
+
end
|
100
|
+
|
101
|
+
false
|
94
102
|
end
|
95
103
|
|
96
104
|
# Public: Check if the file has one of the allowed extensions
|
@@ -305,6 +313,7 @@ module Jekyll
|
|
305
313
|
selector = Configurator.algolia('nodes_to_index')
|
306
314
|
first_node = Nokogiri::HTML(html).css(selector).first
|
307
315
|
return nil if first_node.nil?
|
316
|
+
|
308
317
|
first_node.to_s
|
309
318
|
end
|
310
319
|
|
@@ -54,11 +54,7 @@ module Jekyll
|
|
54
54
|
total: indexable_item_count,
|
55
55
|
format: 'Rendering to HTML (%j%%) |%B|'
|
56
56
|
)
|
57
|
-
Jekyll::Hooks.register :pages, :post_render do
|
58
|
-
progress_bar.increment
|
59
|
-
end
|
60
|
-
|
61
|
-
Jekyll::Hooks.register :documents, :post_render do |_|
|
57
|
+
Jekyll::Hooks.register [:pages, :documents], :post_render do
|
62
58
|
progress_bar.increment
|
63
59
|
end
|
64
60
|
end
|
data/lib/jekyll/algolia/utils.rb
CHANGED
@@ -42,6 +42,7 @@ module Jekyll
|
|
42
42
|
# html - String representation of the HTML node
|
43
43
|
def self.html_to_text(html)
|
44
44
|
return nil if html.nil?
|
45
|
+
|
45
46
|
text = Nokogiri::HTML(html).text
|
46
47
|
text.tr("\n", ' ').squeeze(' ').strip
|
47
48
|
end
|
@@ -54,6 +55,7 @@ module Jekyll
|
|
54
55
|
hash.each do |key, value|
|
55
56
|
next if value.nil?
|
56
57
|
next if value.is_a?(String) && value.empty?
|
58
|
+
|
57
59
|
new_hash[key] = value
|
58
60
|
end
|
59
61
|
new_hash
|
@@ -84,6 +86,7 @@ module Jekyll
|
|
84
86
|
# It is basically a wrapper around [].find, handling more edge-cases
|
85
87
|
def self.find_by_key(items, key, value)
|
86
88
|
return nil if items.nil?
|
89
|
+
|
87
90
|
items.find do |item|
|
88
91
|
item[key] == value
|
89
92
|
end
|
@@ -140,6 +143,7 @@ module Jekyll
|
|
140
143
|
end
|
141
144
|
|
142
145
|
return nil if diff.empty?
|
146
|
+
|
143
147
|
diff
|
144
148
|
end
|
145
149
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-algolia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Carry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07
|
11
|
+
date: 2018-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: algolia_html_extractor
|
@@ -334,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
334
334
|
version: '0'
|
335
335
|
requirements: []
|
336
336
|
rubyforge_project:
|
337
|
-
rubygems_version: 2.
|
337
|
+
rubygems_version: 2.7.7
|
338
338
|
signing_key:
|
339
339
|
specification_version: 4
|
340
340
|
summary: Index your Jekyll content into Algolia
|