为什么不为使用--blank创建的网站生成网页?

时间:2017-05-21 18:06:22

标签: jekyll

注意:我可能已经遇到了在Linux for Windows 10环境中运行的Jekyll的边缘情况。纯Windows或纯Linux上使用的相同数据按预期工作(在@marcanuy的答案之后进行修改之后)。经过更多测试后我会回来。

我通过

创建了一个新网站
class Pulse extends React.Component {
  render() {
    return (
      <Star style={{top: {this.props.top} + 'em'}}></Star>
    );
  }
}

export default Pulse;

这在jekyll new myblog --blank 中创建了预期的结构。我添加了一个模板myblog

_layouts/docs.html

然后我创建了一个<h1>hello world</h1> {{ content }} 文件:

_posts/hello.md

运行后

---
title = the hello world page
layout = docs
---

# this is a hello world page

Hello world everyone

我的# jekyll build Configuration file: none Source: /root/myblog Destination: /root/myblog/_site Incremental build: disabled. Enable with --incremental Generating... done in 0.03 seconds. Auto-regeneration: disabled. Use --watch to enable. 文件夹为空,除了从我的博客根目录复制的_site文件(逐字复制 - 这是我在根目录中放入index.html的内容)< / p>

为什么没有index.html生成?我希望它包含

hello.html

1 个答案:

答案 0 :(得分:1)

有两个问题让jekyll没有建立“你好”页面:

的文件名

  • 如果您将hello.md放在_posts文件夹中,那么正确的文件名应包含帖子的日期,如:2017-05-21-hello.md

然后它将可用:

.
├── _drafts
├── index.html
├── _layouts
│   └── docs.html
├── _posts
│   └── 2017-05-21-hello.md
└── _site
    ├── hello.html
    └── index.html

另一种方法是将其发布为page

  • /hello.md中,即:在根级别(不在/_posts内)

    .
    ├── _drafts
    ├── hello.md
    ├── index.html
    ├── _layouts
    │   └── docs.html
    ├── _posts
    └── _site
    ├── hello.html
    └── index.html
    

frontmatter

另一个问题是hello.md的前端问题的语法,每个属性应使用:而不是=来定义:

---
title: the hello world page
layout: docs
---

# this is a hello world page

Hello world everyone