新的 Jekyll 页面未链接到样式 Sheet

New Jekyll Pages Not Linking To Style Sheet

我创建了一个新的 Jekyll 页面,在顶部包含适当的 YAML Front Matter 信息。我的问题是页面呈现时没有任何样式。经过检查,我发现 head 标签是空的,所以 CSS 没有链接。我确定我遗漏了一些非常明显的东西,但我很困惑。我看到样式 sheet 链接到索引页面,而不是我的新页面,我不知道我缺少什么来包含链接到我的样式 sheet 的头部数据。这是我的新页面中的内容。

---
layout: default
title: New Site
---

<div>
  <div>

      <h2>
        <a href="test.html">Our Sweet Test Page</a>
      </h2>

      <section>
        <article class="dope-page">
          <h1>Test Headline</h1>
        </article>
      </section>

    </div>
</div>

这正是未加载模板时发生的情况。您的 _layouts 目录中是否有一个 default.html 文件,其中包含样式表的 link?

在我看来,Jekyll 使用 layout 参数在 index.html 旁边呈现页面,并在 _layouts 文件夹中找到布局。在你的情况下,你使用 layout: default 所以你应该检查 _layouts/default.html 文件。

jekyll new your_awesome_site 生成的 default.html 文件应如下所示:

<!DOCTYPE html>
<html>

  {% include head.html %}

  <body>

    {% include header.html %}

    <div class="page-content">
      <div class="wrapper">
        {{ content }}
      </div>
    </div>

    {% include footer.html %}

  </body>

</html>

css 个文件在 _includes/head.html 中。