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

Return unless 'jekyll-archives' config is a Hash #139

Merged
merged 1 commit into from
Aug 21, 2019

Conversation

ashmaroli
Copy link
Member

If the user or a third-party plugins sets config["jekyll-archives"] to nil or something but a Hash, output a warning and turn-off the archives generator.

Closes #138

@ashmaroli ashmaroli requested a review from a team April 23, 2019 18:00
Copy link
Member

@mattr- mattr- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit about wording, but good otherwise.

@config = Utils.deep_merge_hashes(DEFAULTS, archives_config)
else
@config = nil
Jekyll.logger.warn "Archives:", "Expected a hash but got #{archives_config.inspect}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to force our users to care about data structures? What about something like

Suggested change
Jekyll.logger.warn "Archives:", "Expected a hash but got #{archives_config.inspect}"
Jekyll.logger.warn "Archives:", "The configuration appears to be invalid"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattr- I'm not sure about this suggestion..
When a third-party plugin (e.g. jekyll-algolia) erroneously sets config["jekyll-archives"] to nil explicitly, a simple "The configuration appears to be invalid" is going to throw the user into more confusion because:

  • First of all, their config file doesn't have a jekyll-archives key.
  • Secondly, they have no context as to why the configuration is invalid.
  • they have no backtrace to debug on their own.

@DirtyF
Copy link
Member

DirtyF commented Aug 21, 2019

@jekyllbot: merge +fix

@jekyllbot jekyllbot merged commit f9e3c61 into jekyll:master Aug 21, 2019
jekyllbot added a commit that referenced this pull request Aug 21, 2019
@ashmaroli ashmaroli deleted the return-when-config-nil branch August 22, 2019 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants