Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow symbols for use in pagination/prototype front matter #386

Merged
merged 1 commit into from Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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