jekyll_pages_api 0.1.3 → 0.1.4
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 +4 -4
- data/README.md +4 -0
- data/lib/jekyll_pages_api/page.rb +8 -2
- data/lib/jekyll_pages_api/version.rb +1 -1
- data/spec/integration_spec.rb +7 -0
- data/spec/page_spec.rb +15 -0
- data/spec/site/about.md +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 165870f35595456ebb5c185976419aa41650dcc3
|
4
|
+
data.tar.gz: 8665a9c9c4e2d0c3caaf33d264f29eee1b9d75cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae0bf9b1c790a930caddb014292fdfd635e2df275e46fb5e7d60c7982475ef0dae327268db27a8a1be4e029175d2b1d90507ae0a5662bb545e4e3e746821ac9a
|
7
|
+
data.tar.gz: 82ff7e227cba6611f48acb6dd6ee5dc27a43bc4522060f0b7ee3cedfcb14efafd27af8b4ca5b4041187dce2d7601adf9aae12340c13a63c1242d29a15dd38636
|
data/README.md
CHANGED
@@ -40,6 +40,10 @@ You can then see the generated JSON file at http://localhost:4000/api/v1/pages.j
|
|
40
40
|
|
41
41
|
This endpoint will be re-generated any time your site is rebuilt.
|
42
42
|
|
43
|
+
### Skipping the index
|
44
|
+
|
45
|
+
The [Jekyll Pages API Search plugin](https://github.com/18F/jekyll_pages_api_search) uses this plugin to build a search index. Add `skip_index: true` to the front matter of any documents you wish to exclude from this index.
|
46
|
+
|
43
47
|
## Developing
|
44
48
|
|
45
49
|
* Run `bundle` to install any necessary gems.
|
@@ -52,13 +52,19 @@ module JekyllPagesApi
|
|
52
52
|
(self.page.data['tags'] if self.page.respond_to?(:data)) || []
|
53
53
|
end
|
54
54
|
|
55
|
+
def skip_index?
|
56
|
+
(self.page.data['skip_index'] if self.page.respond_to?(:data)) || false
|
57
|
+
end
|
58
|
+
|
55
59
|
def to_json
|
56
|
-
{
|
60
|
+
optional = {}
|
61
|
+
optional['skip_index'] = true if self.skip_index?
|
62
|
+
optional.merge({
|
57
63
|
title: self.title,
|
58
64
|
url: self.url,
|
59
65
|
tags: self.tags,
|
60
66
|
body: self.body_text
|
61
|
-
}
|
67
|
+
})
|
62
68
|
end
|
63
69
|
end
|
64
70
|
end
|
data/spec/integration_spec.rb
CHANGED
@@ -95,4 +95,11 @@ describe "integration" do
|
|
95
95
|
page = page_data('/about/')
|
96
96
|
expect(page['tags']).to eq(["Jekyll", "test page", "convenient"])
|
97
97
|
end
|
98
|
+
|
99
|
+
it "sets skip_index only if it is true" do
|
100
|
+
page = page_data('/about/')
|
101
|
+
expect(page['skip_index']).to eq(true)
|
102
|
+
page = page_data('/unicode.html')
|
103
|
+
expect(page['skip_index']).to eq(nil)
|
104
|
+
end
|
98
105
|
end
|
data/spec/page_spec.rb
CHANGED
@@ -99,4 +99,19 @@ describe JekyllPagesApi::Page do
|
|
99
99
|
expect(page.body_text).to eq("foo bar baz")
|
100
100
|
end
|
101
101
|
end
|
102
|
+
|
103
|
+
describe "#skip_index?" do
|
104
|
+
it "defaults to false if the 'data' member isn't present" do
|
105
|
+
expect(create_static_file(BASEURL, '/foo/').skip_index?).to eq(false)
|
106
|
+
end
|
107
|
+
|
108
|
+
it "defaults to false if the 'skip_index' field isn't present" do
|
109
|
+
expect(create_page(BASEURL, '/foo/').skip_index?).to eq(false)
|
110
|
+
end
|
111
|
+
|
112
|
+
it "returns true if data['skip_index'] is true" do
|
113
|
+
page = create_page(BASEURL, '/foo/', data:{'skip_index' => true})
|
114
|
+
expect(page.skip_index?).to eq(true)
|
115
|
+
end
|
116
|
+
end
|
102
117
|
end
|
data/spec/site/about.md
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_pages_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aidan Feldman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|