jekyll-strapi-4 1.0.8 → 1.0.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7289a0f9686e5f9289fe30b3580e2d7d005bd60e278558a31d273f5f1f97dcbd
4
- data.tar.gz: 295affa7b21e10d7cc2a2fd6842c7dd480929666a24a1ab7d9cd78620773394f
3
+ metadata.gz: 11f2413b8ff5e498215c24ff334e01387486d45a2df93fe293285ec1b5448da3
4
+ data.tar.gz: 470884035a4e77436279b59816da00fe13464a36b705b1b0520c87024335aeab
5
5
  SHA512:
6
- metadata.gz: 77f96155a4de67a0b0dad619c1c3bd0c642ac5eeb3056105db22db2e9c3cac9fa6f06921f370b83bd2826a8ec90d8c10730f79fb5ca3e442e755b99eb70a5f18
7
- data.tar.gz: 683951fef058e5d38d4a35d098cc175af841c5ed9cdc75099085520e7d1be45461f951103a2a54577edb8c3b8ccb02a6244646ce7a26bf6497d75b1417696762
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.8"
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.8
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-29 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
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: '0'
102
+ version: 3.0.0
103
103
  required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  requirements:
105
105
  - - ">="