# Jekyll configuration

**URL:** <https://talk.jekyllrb.com/t/jekyll-configuration/7790>\
**Category:** Help\
**Created:** [November 11, 2022, 3:40pm UTC](https://talk.jekyllrb.com/t/jekyll-configuration/7790 "2022-11-11T15:40:29Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![caolin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/caolin/32/1261_2.png) [@caolin](https://talk.jekyllrb.com/u/caolin)\
**Post date:** [November 11, 2022, 3:40pm UTC](https://talk.jekyllrb.com/t/jekyll-configuration/7790/1 "2022-11-11T15:40:30Z")

</div>

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:

```auto
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:

```auto
 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.

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [November 11, 2022, 4:04pm UTC](https://talk.jekyllrb.com/t/jekyll-configuration/7790/2 "2022-11-11T16:04:53Z")

</div>

> [@caolin](#):
>
> `_config.yml): did not find expected key while parsing a block mapping at line 2 column 1 `

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.

---

<div class="post-metadata">

**Author:** ![caolin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/caolin/32/1261_2.png) [@caolin](https://talk.jekyllrb.com/u/caolin)\
**Post date:** [November 11, 2022, 4:07pm UTC](https://talk.jekyllrb.com/t/jekyll-configuration/7790/3 "2022-11-11T16:07:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [November 11, 2022, 4:08pm UTC](https://talk.jekyllrb.com/t/jekyll-configuration/7790/4 "2022-11-11T16:08:31Z")

</div>

> [@caolin](#):
>
> `Default site variables`

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?.

---

<div class="post-metadata">

**Author:** ![caolin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/caolin/32/1261_2.png) [@caolin](https://talk.jekyllrb.com/u/caolin)\
**Post date:** [November 11, 2022, 4:09pm UTC](https://talk.jekyllrb.com/t/jekyll-configuration/7790/5 "2022-11-11T16:09:20Z")

</div>

It looks like the complete file to me, thanks.

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [November 11, 2022, 4:10pm UTC](https://talk.jekyllrb.com/t/jekyll-configuration/7790/6 "2022-11-11T16:10:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![caolin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/caolin/32/1261_2.png) [@caolin](https://talk.jekyllrb.com/u/caolin)\
**Post date:** [November 11, 2022, 4:13pm UTC](https://talk.jekyllrb.com/t/jekyll-configuration/7790/7 "2022-11-11T16:13:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [November 11, 2022, 4:26pm UTC](https://talk.jekyllrb.com/t/jekyll-configuration/7790/8 "2022-11-11T16:26:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ninja](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/ninja/32/4925_2.png) [@ninja](https://talk.jekyllrb.com/u/ninja)\
**Post date:** [November 11, 2022, 4:27pm UTC](https://talk.jekyllrb.com/t/jekyll-configuration/7790/9 "2022-11-11T16:27:18Z")

</div>

try this

```auto

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

```

---

<div class="post-metadata">

**Author:** ![caolin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/caolin/32/1261_2.png) [@caolin](https://talk.jekyllrb.com/u/caolin)\
**Post date:** [November 11, 2022, 4:35pm UTC](https://talk.jekyllrb.com/t/jekyll-configuration/7790/10 "2022-11-11T16:35:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![caolin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/caolin/32/1261_2.png) [@caolin](https://talk.jekyllrb.com/u/caolin)\
**Post date:** [November 11, 2022, 4:41pm UTC](https://talk.jekyllrb.com/t/jekyll-configuration/7790/11 "2022-11-11T16:41:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ninja](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/ninja/32/4925_2.png) [@ninja](https://talk.jekyllrb.com/u/ninja)\
**Post date:** [November 11, 2022, 4:44pm UTC](https://talk.jekyllrb.com/t/jekyll-configuration/7790/12 "2022-11-11T16:44:20Z")

</div>

@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.
