Jekyll configuration

I am attempting to create a config.yml file and have been stuck for several hours on an error that I can´t interpret.
Command line listing:

jekyll 4.3.1 | Error:  (/home/jonathan/ProgrammingFreedom/General/website/_config.yml): did not find expected key while parsing a block mapping at line 2 column 1
/home/jonathan/gems/gems/safe_yaml-1.0.5/lib/safe_yaml/load.rb:143:in `parse': (/home/jonathan/ProgrammingFreedom/General/website/_config.yml): did not find expected key while parsing a block mapping at line 2 column 1 (Psych::SyntaxError)
        from /home/jonathan/gems/gems/safe_yaml-1.0.5/lib/safe_yaml/load.rb:143:in `load'
        from /home/jonathan/gems/gems/safe_yaml-1.0.5/lib/safe_yaml/load.rb:157:in `block in load_file'
        from /home/jonathan/gems/gems/safe_yaml-1.0.5/lib/safe_yaml/load.rb:157:in `open'
        from /home/jonathan/gems/gems/safe_yaml-1.0.5/lib/safe_yaml/load.rb:157:in `load_file'
        from /home/jonathan/gems/gems/jekyll-4.3.1/lib/jekyll/configuration.rb:129:in `safe_load_file'
        from /home/jonathan/gems/gems/jekyll-4.3.1/lib/jekyll/configuration.rb:167:in `read_config_file'
        from /home/jonathan/gems/gems/jekyll-4.3.1/lib/jekyll/configuration.rb:198:in `block in read_config_files'
        from /home/jonathan/gems/gems/jekyll-4.3.1/lib/jekyll/configuration.rb:195:in `each'
        from /home/jonathan/gems/gems/jekyll-4.3.1/lib/jekyll/configuration.rb:195:in `read_config_files'
        from /home/jonathan/gems/gems/jekyll-4.3.1/lib/jekyll.rb:118:in `configuration'
        from /home/jonathan/gems/gems/jekyll-4.3.1/lib/jekyll/command.rb:44:in `configuration_from_options'
        from /home/jonathan/gems/gems/jekyll-4.3.1/lib/jekyll/commands/serve.rb:83:in `block (2 levels) in init_with_program'
        from /home/jonathan/gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        from /home/jonathan/gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        from /home/jonathan/gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        from /home/jonathan/gems/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        from /home/jonathan/gems/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        from /home/jonathan/gems/gems/jekyll-4.3.1/exe/jekyll:15:in `<top (required)>'
        from /home/jonathan/gems/bin/jekyll:25:in `load'
        from /home/jonathan/gems/bin/jekyll:25:in `<top (required)>'
        from /home/jonathan/gems/gems/bundler-2.3.24/lib/bundler/cli/exec.rb:58:in `load'
        from /home/jonathan/gems/gems/bundler-2.3.24/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from /home/jonathan/gems/gems/bundler-2.3.24/lib/bundler/cli/exec.rb:23:in `run'
        from /home/jonathan/gems/gems/bundler-2.3.24/lib/bundler/cli.rb:486:in `exec'
        from /home/jonathan/gems/gems/bundler-2.3.24/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /home/jonathan/gems/gems/bundler-2.3.24/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /home/jonathan/gems/gems/bundler-2.3.24/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /home/jonathan/gems/gems/bundler-2.3.24/lib/bundler/cli.rb:31:in `dispatch'
        from /home/jonathan/gems/gems/bundler-2.3.24/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /home/jonathan/gems/gems/bundler-2.3.24/lib/bundler/cli.rb:25:in `start'
        from /home/jonathan/gems/gems/bundler-2.3.24/exe/bundle:48:in `block in <top (required)>'
        from /home/jonathan/gems/gems/bundler-2.3.24/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
        from /home/jonathan/gems/gems/bundler-2.3.24/exe/bundle:36:in `<top (required)>'
        from /home/jonathan/gems/bin/bundle:25:in `load'
        from /home/jonathan/gems/bin/bundle:25:in `<main>'

My _config.yml file:

 Default site variables
defaults:
  -
    scope:
      path: ""
    values:
      layout: "default"
  -
    scope:
      path: ""
      type: "posts"
    values:
      layout:  "post"
  -
    scope:
      path:  ""
      type:  "pages"
    values:
      layout: "page"

Custom variables for use in content

content:
project-name: “Programming Freedom”

Collection information

collections_dir: “collections”

collections:
ProgrammingFreedom:
posts:
essays:
documentation:
Contributors:
jgossage:
posts:
essays:

Can anyone see what I have done wrong. I expect a typo or simple syntax error.

I think it is unhappy about some ymal formatting in the config file?

can you post the entire config file - and wrap it in three back tics (```) so it is in a code block? I edited your first post to do this.

That appears to be the complete yaml file. I did a copy/paste to include it.

is that in the file or did I put the code block in the wrong place? that is not valid I assume I put the code block in the wrong place?.

It looks like the complete file to me, thanks.

if Default site variables is in the actual config file either remove it or put a # in front of it to make it a comment. It is not a valid thing to be in there.

That part was working before I augmented the configuration file and was taken directly from Jekyll documentation. As I understand it, it is suposed to provides default Liquid variables for different parts of the site.

can you post a link to your repo?

and yes, the scopes will provide default values, but the actual line that says Default site variables is not valid.

try this


# Default site variables
defaults:
  - scope:
      path: ""
    values:
      layout: "default"
  - scope:
      path: ""
      type: "posts"
    values:
      layout:  "post"
  - scope:
      path:  ""
      type:  "pages"
    values:
      layout: "page"

That comment was in working code before. What is wrong with it?

I found the problem. Some blank lines contained stray blanks, When the blanks were removed, everything worked, thankyou,

@caolin, yeah finally you know it.
it hard to explain since you ask why!! i have no idea what it happen but i got situation like you before. and that how i fixed ft., remove unnecessary blank space, and everything will be normal again.