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

Fix bad config YAML in collections example #5587

Merged
merged 1 commit into from Nov 29, 2016

Conversation

Projects
None yet
6 participants
@happycollision
Contributor

happycollision commented Nov 17, 2016

If you add the previous version to your config file, you'd get an error on build/serve.

Fix bad config YAML in collections example
If you add the previous version to your config file, you'd get an error on build/serve.
@pathawks

collections needs to be an array, not a hash.

@happycollision

This comment has been minimized.

Show comment
Hide comment
@happycollision

happycollision Nov 17, 2016

Contributor

That's what I thought, but putting this into the config file:

collections:
  - my_collection:
      output: true

results in this error in the terminal:

Configuration file: /Users/Don/Git Projects/some-site/_config.yml
            Source: /Users/Don/Git Projects/some-site
       Destination: /Users/Don/Git Projects/some-site/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
jekyll 3.0.2 | Error:  undefined method `gsub' for {"my_collection"=>{"output"=>true}}:Hash

Conversely, this

collections:
  my_collection:
    output: true

produces no errors and behaves as expected (the collection outputs and I can access it at site.my_collection).

This also seems to be exactly in line with the current documentation for collections. (Or that same collection documentation from the latest commit on master)

Just above that link on those pages is the "Step 1" section, which seems to suggest that if you want to specify metadata for a collection, you must not use an array. From the documentation:

Add the following to your site's _config.yml file, replacing my_collection
with the name of your collection:

collections:
- my_collection

You can optionally specify metadata for your collection in the configuration:

collections:
  my_collection:
    foo: bar

Am I missing something?

Contributor

happycollision commented Nov 17, 2016

That's what I thought, but putting this into the config file:

collections:
  - my_collection:
      output: true

results in this error in the terminal:

Configuration file: /Users/Don/Git Projects/some-site/_config.yml
            Source: /Users/Don/Git Projects/some-site
       Destination: /Users/Don/Git Projects/some-site/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
jekyll 3.0.2 | Error:  undefined method `gsub' for {"my_collection"=>{"output"=>true}}:Hash

Conversely, this

collections:
  my_collection:
    output: true

produces no errors and behaves as expected (the collection outputs and I can access it at site.my_collection).

This also seems to be exactly in line with the current documentation for collections. (Or that same collection documentation from the latest commit on master)

Just above that link on those pages is the "Step 1" section, which seems to suggest that if you want to specify metadata for a collection, you must not use an array. From the documentation:

Add the following to your site's _config.yml file, replacing my_collection
with the name of your collection:

collections:
- my_collection

You can optionally specify metadata for your collection in the configuration:

collections:
  my_collection:
    foo: bar

Am I missing something?

I guess you're right 👍

@ashmaroli

👍

@DirtyF DirtyF self-assigned this Nov 22, 2016

@parkr

parkr approved these changes Nov 29, 2016

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Nov 29, 2016

Member

Thank you!

@jekyllbot: merge +site

Member

parkr commented Nov 29, 2016

Thank you!

@jekyllbot: merge +site

@jekyllbot jekyllbot merged commit ec7378a into jekyll:master Nov 29, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

jekyllbot added a commit that referenced this pull request Nov 29, 2016

@happycollision happycollision deleted the happycollision:patch-1 branch Nov 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment