集合页面不继承默认样式

Collection pages not inheriting default styling

问题:我为我的 Jekyll 站点设置了一个名为 Projects 的集合。它在 portfolio.html 上输出页面。各个项目存储在_projects中,继承portfolio_piece.html布局风格。 portfolio_piece.html 应该具有 default.html 布局样式,但它不起作用。当我尝试手动将我需要的代码添加到 portfolio_piece.html 时,它也不起作用。它们都只会产生具有必要内容的无样式页面。难道我做错了什么?

Config.yml

# projects
collections:
  projects:
    output: true

portfolio.html

{% for each in site.projects %}
<div class="six columns">
    <a href="{{ each.url }}" title="{{ each.title }}"><img src="{{ each.image_thumb }}" alt="{{ projects.title }}"></a>
        <h4>{{ each.title }}</h4>
        <p><span class="desc project">{{ each.description }}</span></p>
</div>
{% endfor %}

_projects/project.md

---
layout: portfolio_piece
image_thumb: http://placehold.it/350x250
image_full: http://placehold.it/600x300
title: Toei Channel
description: Branding / Design / Development
---

_layouts/portfolio_piece.html

---
layout: default
---

   <div class="row"> 

<a href="#" title="{{ page.title }}">
    <img src="{{ page.image_full }}" alt="{{ page.title }}">
</a>
<h4>{{ page.title }}</h4>
<p>
    <span class="desc project">{{ page.description }}</span>
</p>
</div>

_layouts/default.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>{% if site.title %} {{ site.title }} {% endif %}</title>
  <meta name="description" content="{% if site.description %} {{ site.description }} {% endif %}">
  <meta name="author" content="{% if site.author %} {{ site.author }} {% endif %}">
  <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- fonts -->
  <link href="//fonts.googleapis.com/css?family=Raleway:200,300,400,600" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Merriweather:300" rel="stylesheet" type="text/css">
    <!-- css -->
  <link rel="stylesheet" href="css/normalize.css">
  <link rel="stylesheet" href="css/skeleton.css">
    <link rel="stylesheet" href="css/style.css">
    <!-- favicon -->
  <link rel="icon" type="image/png" href="images/favicon.png">

</head>
<body>
    
  <div class="container">
      
      {{ content }}

    </div> <!-- end .container -->

    <!-- external scripts -->
    <script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="js/scripts.js"></script>
</body>
</html>

如果您的站点位于域的根目录 (http://yourdoamin.tld),您可以这样调用您的资源:

<link rel="stylesheet" href="/css/normalize.css">
<script src="/js/scripts.js"></script>
<img src="/path/to/img/toto.jpg">

如果您的站点 在您域的根目录 (http://yourdoamin.tld/somefolder),

_config.yml 中将 baseurl 设置为 /somefolder (baseurl: somefolder)

这样调用您的资源:

<link rel="stylesheet" href="{{ site.baseurl }}/css/normalize.css">
<script src="{{ site.baseurl }}/js/scripts.js"></script>
<img src="{{ site.baseurl }}/path/to/img/toto.jpg">