Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Read options from config to support querying in different languages #5

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bridgetown-prismic.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |spec|

spec.add_dependency "bridgetown", ">= 1.2.0", "< 2.0"
spec.add_dependency "prismic.io", ">= 1.8"
spec.add_dependency "async", ">= 2.0"
spec.add_dependency "async", ">= 1.30", "< 2.0"

spec.add_development_dependency "bundler"
spec.add_development_dependency "rake", ">= 13.0"
Expand Down
2 changes: 1 addition & 1 deletion lib/bridgetown-prismic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def self.prismic_data(origin, doc = nil) # rubocop:todo Metrics/AbcSize, Metrics
site = Bridgetown::Current.site
@prismic_data = Bridgetown::Utils::PrismicData.new(scope: self)

unless doc
unless doc && doc.instance_of?(Prismic::Document)
prismic_id = origin.id.split("/").last
# NOTE: if site.config.prismic_preview_token isn't set, it will default to
# master (published) ref
Expand Down
2 changes: 2 additions & 0 deletions lib/bridgetown-prismic/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def query_prismic(custom_type, options = {})
page = 1
finalpage = false
options["pageSize"] ||= 100 # pull in as much data as possible for a single request
query_options = Bridgetown::Current.site.config.prismic_query_options
options.merge!(query_options) if query_options

until finalpage
options["page"] = page
Expand Down