bridgetown-prismic 0.2.0 → 0.2.1

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: c9490120f332e574829b9e86bb4e5cd8e116cc5d56459deaa6d008918d1259e7
4
- data.tar.gz: 429b14738f5b6d15cee42b023085b71aa27ce69fcb9a108398efcabccc4aca33
3
+ metadata.gz: edc984dde8e51c56c4b6da117b7f0a16f5fb81ec966ff28b9424bde9c2bc7858
4
+ data.tar.gz: 3e553d7e6af94da3cf2590fe4b2301c1e368c7dfc95408898a41e0aa28438925
5
5
  SHA512:
6
- metadata.gz: 847aebd7f01e975dead3b109ff69d65171da42d1f2a163b1ebf2fc26ffffc5b54db23949ab7027687b20d5b02da6266a1bcb6c90191343658ddfe138d1be1e52
7
- data.tar.gz: 1d3cde2d78fcd09a22fa26b67caec953a8f9074b101079ead246f74f6e1c19936b405c9e3857c56c9d97eb7612f3f9d459c4dadabe62800b24fbc42ed6920df9
6
+ metadata.gz: ec881170fdaff8ef22f840cffd403b1dd4bcfa427bb858db4487e75a47c7b59ceb4e5a8b1135e850378f2c400761ceb81fb01893d5c6ba15c31cc26fb333d6c1
7
+ data.tar.gz: 124c223cdfc6ff567acd33c67e0986ac4d4a88ca05e881e7f0be160709393f5f085c7d108cb8d1f3014dd55d87862e716894fd13319d703e5590397c2bbfd60e
data/CHANGELOG.md CHANGED
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ...
11
11
 
12
+ ## 0.2.1
13
+
14
+ - Fix issue where link resolvers didn't provide the full document
15
+
12
16
  ## 0.2.0
13
17
 
14
18
  - Automatically paginate through results sets
data/README.md CHANGED
@@ -115,7 +115,7 @@ end
115
115
  * `collection_name`: this can be a built-in collection such as `posts` or `pages`, or it can be a custom collection you've configured in `bridgetown.config.yml`.
116
116
  * `prismic_custom_type`: this will be the "API ID" of the custom type in Prismic.
117
117
  * `prismic_slug`: this should return the "slug" (aka `my-document-title`) of a Prismic document. In this example the slug Prismic chose is being used verbatim, but you can make alterations as you see fit.
118
- * `prismic_url`: this should return the full URL of the final destination for the content. It should match the permalink settings of your collection. This is used by the "link resolver"—aka anywhere in a Prismic document where you've added a link to another Prismic document, the URL for that link to resolved using this return value for the custom type.
118
+ * `prismic_url`: this should return the full URL of the final destination for the content. It should match the permalink settings of your collection. This is used by the "link resolver"—aka anywhere in a Prismic document where you've added a link to another Prismic document, the URL for that link is resolved using this return value for the custom type.
119
119
 
120
120
  All right, with those options out of the way, on to the main event:
121
121
 
@@ -141,7 +141,7 @@ end
141
141
 
142
142
  This where you create the 1:1 mappings between the Prismic fields and the "front matter" (aka data) + content of your model/resource. Any time you access the resource in templates by writing `resource.data.title` or `resource.content`, it will be pulling those values from these mappings.
143
143
 
144
- Within the `provide_data` block, you use a special Ruby DSL in a spreadsheet-like manner to set up the mappings. On the left-hand "column", you specify the name of the front matter variable (or content). In the middle column, you use Prismic's Ruby API to get a field value or metadata. On the right-hand column, you "coerce" the value into the type of data you'r looking for. Note that any field which the author hasn't filled in has a `nil` value, so you can see this is using Ruby's safe navigation operator `&` (whimsically known as the "lonely operator") most of the time so nil values won't crash the import process.
144
+ Within the `provide_data` block, you use a special Ruby DSL in a spreadsheet-like manner to set up the mappings. On the left-hand "column", you specify the name of the front matter variable, as well as `content` (optional but recommended). In the middle column, you use Prismic's Ruby API to get a field value or metadata. On the right-hand column, you "coerce" the value into the type of data you're looking for. Note that any field which the author hasn't filled in has a `nil` value, so you can see we're using Ruby's safe navigation operator `&` (whimsically known as the "lonely operator") most of the time so nil values won't crash the import process.
145
145
 
146
146
  You can [read more about Prismic's Ruby Document API here](https://prismic.io/docs/technologies/the-document-object-ruby) for information on when to use `value` or `as_text` or `url`, etc.
147
147
 
@@ -185,7 +185,7 @@ The Ruby DSL is pretty nifty, but you may occasionally run into a conflict betwe
185
185
  set :method, doc["page.method"].as_text
186
186
  ```
187
187
 
188
- Finally, if you decide to need to bail and want to provide a standard hash instead of using the Ruby DSL, you can do that too!
188
+ Finally, if you decide to need to bail and want to provide a standard hash instead of using the Ruby DSL, you can do that too! It's not as flexible as the DSL because you can't arbitrarily insert multi-line statements of Ruby code within the data hash, but it's easy enough to understand:
189
189
 
190
190
  ```ruby
191
191
  def self.process_prismic_document(doc)
@@ -10,7 +10,12 @@ module BridgetownPrismic
10
10
  next "/preview/#{link.type}/#{link.id}" if site.config.prismic_preview_token
11
11
 
12
12
  if model_exists_for_prismic_type? link.type
13
- model_for_prismic_type(link.type).prismic_url(link)
13
+ full_doc = Async do
14
+ Bridgetown::Current.site = site # ensure fiber has copy of the current site
15
+ site.config.prismic_api.getByID(link.id)
16
+ end.wait
17
+
18
+ model_for_prismic_type(link.type).prismic_url(full_doc)
14
19
  else
15
20
  "/"
16
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BridgetownPrismic
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-prismic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team