Skip to content

Commit

Permalink
Allow symbols for use in pagination/prototype front matter (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcwhite committed Sep 10, 2021
1 parent cc6aea5 commit 725ee05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Expand Up @@ -79,11 +79,11 @@ def ensure_pagination_enabled
# @return [String, nil]
def validate_search_term(prototype_page)
# @type [String]
search_term = prototype_page.data["prototype"]["term"]
return nil unless search_term.is_a?(String)
search_term = prototype_page.data["prototype"]["term"].to_s
return nil unless search_term.present?

if prototype_page.data["prototype"]["collection"]
@configured_collection = prototype_page.data["prototype"]["collection"]
@configured_collection = prototype_page.data["prototype"]["collection"].to_s
end

unless site.collections[@configured_collection]
Expand Down
Expand Up @@ -50,13 +50,18 @@ def run(default_config, templates, site_title) # rubocop:todo Metrics/AbcSize
template_config = Bridgetown::Utils.deep_merge_hashes(
default_config,
template.data["pagination"] || template.data["paginate"] || {}
)
).tap do |config|
config["collection"] = config["collection"].to_s if config["collection"].is_a?(Symbol)
config["category"] = config["category"].to_s if config["category"].is_a?(Symbol)
config["tag"] = config["tag"].to_s if config["tag"].is_a?(Symbol)
config["locale"] = config["locale"].to_s if config["locale"].is_a?(Symbol)
end

# Is debugging enabled on the page level
@debug = template_config["debug"]
_debug_print_config_info(template_config, template.path)

next if template_config["enabled"] == false
next unless template_config["enabled"]

@logging_lambda.call "found page: " + template.path, "debug" unless @debug

Expand Down

0 comments on commit 725ee05

Please sign in to comment.