jekyll_pages_api 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a53015b9d831067e9881896ba4337a0afe277b31
4
- data.tar.gz: fc905c1a196698fc249a52f306111952ec9eac32
3
+ metadata.gz: 165870f35595456ebb5c185976419aa41650dcc3
4
+ data.tar.gz: 8665a9c9c4e2d0c3caaf33d264f29eee1b9d75cf
5
5
  SHA512:
6
- metadata.gz: 67ffc1e1e878040b166ba902879a11f994d91beb11a9f13fbb882277bd76ce996c617c06567da2c0edee8a6b313724d483fe92a8b97feee72ff5260798e3c401
7
- data.tar.gz: 02d73adbe830e228176cf8dd89e14b096f51a0334fdd9a8951cc0fa4a4c39d4b8346225658a9e9201634288022cd9873525551c3d8397e3d875ed60e2ba1986b
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
@@ -1,3 +1,3 @@
1
1
  module JekyllPagesApi
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -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
@@ -6,6 +6,7 @@ tags:
6
6
  - Jekyll
7
7
  - test page
8
8
  - convenient
9
+ skip_index: true
9
10
  ---
10
11
 
11
12
  This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at [jekyllrb.com](http://jekyllrb.com/)
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.3
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-05-31 00:00:00.000000000 Z
11
+ date: 2015-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities