我在命令行终端中收到此错误:
在第18行第7行解析块映射时没有找到预期的键
我的jekyll _config.yml YAML文件如下所示:
title: Oliver Williams - Portfolio
url: "http://yourdomain.com" # the base hostname & protocol for your site
# Build settings
markdown: kramdown
permalink: /:title
defaults:
-
scope:
path: "" # an empty string here means all files in the project
type: "posts" # previously `post` in Jekyll 2.2.
values:
layout: "post"
-
scope:
path: "" # an empty string here means all files in the project
type: "pages"
values:
layout: "page"
Run Code Online (Sandbox Code Playgroud)
我不确定你对_config.yml的格式化/缩进.
这个是正确的:
title: Oliver Williams - Portfolio
url: "http://yourdomain.com"
markdown: kramdown
permalink: /:title
defaults:
-
scope:
path: ""
type: "posts"
values:
layout: "post"
-
scope:
path: ""
type: "pages"
values:
layout: "page"
Run Code Online (Sandbox Code Playgroud)
问题出在默认值的第二个列表元素中。标记缩进太多,可能是因为您使用了制表符而不是两个空格。
没有理由将作为这些列表元素的映射放在单独的行上。如果列表是映射值,则也不必缩进列表元素。也没有必要引用简单的标量,如"posts"、"page"等(你也没有这个title价值)
所以你可以这样做:
title: Oliver Williams - Portfolio
url: http://yourdomain.com # the base hostname & protocol for your site
# Build settings
markdown: kramdown
permalink: /:title
defaults:
- scope:
path: '' # an empty string here means all files in the project
type: posts # previously `post` in Jekyll 2.2.
values:
layout: post
- scope:
path: '' # an empty string here means all files in the project
type: pages
values:
layout: page
Run Code Online (Sandbox Code Playgroud)
这相当于您的输入(针对过度缩进进行了更正-)
| 归档时间: |
|
| 查看次数: |
13329 次 |
| 最近记录: |