簡體   English   中英

新的Jekyll頁面未鏈接到樣式表

[英]New Jekyll Pages Not Linking To Style Sheet

我創建了一個新的Jekyll頁面,在頂部包括相應的YAML前台信息。 我的問題是頁面呈現時沒有任何樣式。 經檢查,我發現head標簽為空,因此CSS未鏈接。 我確定我遺漏了一些非常明顯的東西,但是我很沮喪。 我看到樣式表鏈接到索引頁面,而不是我的新頁面,並且我不知道缺少鏈接到樣式表的head數據所需要的內容。 這是我新頁面中的內容。

---
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文件,其中包含指向樣式表的鏈接?

以我的觀點,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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM