jekyll-strapi-4 1.0.11 → 1.0.12

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
  SHA256:
3
- metadata.gz: 8b31d0685e0cf93d50266d0441f2443844490c8cbac85623d45e681fd8e314d0
4
- data.tar.gz: b1ad36f797a7c72fc225609ad180bfa36bba14989663cdcbfd7c6c55d7b9ddf0
3
+ metadata.gz: 11f2413b8ff5e498215c24ff334e01387486d45a2df93fe293285ec1b5448da3
4
+ data.tar.gz: 470884035a4e77436279b59816da00fe13464a36b705b1b0520c87024335aeab
5
5
  SHA512:
6
- metadata.gz: e5dfe007b2eb941bd90880365d9206bee68b02a99b6078b3eccda949b5d5de69102aa666736f5c8a6d629548b9420cdc271d8201cec78edffb2f166a12dbf521
7
- data.tar.gz: 66473f2427153d6ad3b196e8eb948ab4964018c491fdbfadce0ba6708e29d47bf451b51a00abbe190c7d4479b9afd78487b5bab341229cbd3bb982a177f53d71
6
+ metadata.gz: 6fe26d4fa4d8b654676b84e54bfd66aa10e779e0b2a93ca61282d8caa03d3d1732681aca69e38ff8bfa2e936cd2b74727c02ef996b82138dcec4b04c07e1f21c
7
+ data.tar.gz: 5a6111df4ee89bb3c80208c90e5e5739f05ffd71d2fe2df5cd1a5cb1cdcf274e39a0baecfe6714526f232cc5b0e4257bc0051b4695d85aa9a70c6c23507b8927
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # jekyll-strapi-4
2
2
 
3
- This plugin is based on the [jekyll-strapi](https://github.com/strapi-community/jekyll-strapi/) plugin.
3
+ This plugin works with Strapi 4 and is based on [jekyll-strapi](https://github.com/strapi-community/jekyll-strapi/tree/v0.1.2) plugin for Strapi 3.
4
4
 
5
5
  ![](deer-jekyll-strapi-4.png?raw=true)
6
6
 
@@ -58,6 +58,8 @@ strapi:
58
58
  # populate: "*"
59
59
  # Layout file for this collection
60
60
  layout: photo.html
61
+ # Single request for collection, default false
62
+ single_request: true
61
63
  # Generate output files or not (default: false)
62
64
  output: true
63
65
  ```
@@ -140,6 +142,19 @@ module Jekyll
140
142
  end
141
143
  ```
142
144
 
145
+ ### Single request
146
+
147
+ When you request for a collection it makes a collection request and collection resources request. When you have a small collection like testimonials you might not make n+1 requests but only one. In that case use single_request: true in your _config file.
148
+
149
+ ```yaml
150
+ strapi:
151
+ collections:
152
+ photos:
153
+ single_request: true
154
+ ```
155
+
156
+ You can always add to your parameters populate parameter to get additional data in your collection request.
157
+
143
158
  ### Permalinks
144
159
 
145
160
  When you have a multi-language content, you might want generate a proper url based on different patterns, for example:
@@ -48,9 +48,13 @@ module Jekyll
48
48
  document.type = collection_name
49
49
  document.collection = collection_name
50
50
  document.id ||= document._id
51
- document_response = get_document(document.id)
52
- # We will keep all the attributes in strapi_attributes
53
- document.strapi_attributes = document_response['data']["attributes"]
51
+ if single_request?
52
+ document.strapi_attributes = document.attributes
53
+ else
54
+ document_response = get_document(document.id)
55
+ # We will keep all the attributes in strapi_attributes
56
+ document.strapi_attributes = document_response['data']["attributes"]
57
+ end
54
58
  document.url = @site.strapi_link_resolver(collection_name, document)
55
59
  end
56
60
  data.each {|x| yield(x)}
@@ -89,6 +93,10 @@ module Jekyll
89
93
  return_params ? string : ""
90
94
  end
91
95
 
96
+ def single_request?
97
+ @config["single_request"] == true
98
+ end
99
+
92
100
  def custom_path_params
93
101
  # Define custom logic in your _plugins/file_name.rb
94
102
  ""
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Strapi
3
- VERSION = "1.0.11"
3
+ VERSION = "1.0.12"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-strapi-4
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Strapi Solutions
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-07-30 00:00:00.000000000 Z
13
+ date: 2022-09-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: down