Jekyll 读取配置错误,并且在网络上什么也没显示,我的系统是 win7



当我在cmd上执行"jekyll server --safe - watch"时,我有以下警告:

警告:读取配置时出错。使用默认值 。配置文件:<INVALID> D:/git/blog/_config.yml

我的 html 源文件是:

/git/blog/index.html:

---
layout: default
---
Hello jekyll

和/git/blog/_layouts/default.html:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>My blog</title>
    </head>
    <body></body>
</html>

但我在网页上什么也没得到,除了标题"我的博客",有人以前遇到过这种情况吗???

除非您在

布局文件中的某个位置添加了 Liquid 标记{{ content }},否则您将看不到 HTML 源文件中Hello jekyll的内容。这是显示页面中内容的位置。

喜欢这个:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>My blog</title>
    </head>
    <body>{{ content }}</body>
</html>

另外,您的配置文件似乎丢失了,就像David Jacquel在他的评论中已经说过的那样。
这不一定是坏事,只是 Jekyll 会在不存在配置文件时使用默认配置。

但是缺少配置文件与您的网页没有显示任何内容的事实没有任何关系 - 这是因为缺少{{ content }}标签,就像我在开头所说的那样!

最新更新