Jekyll不在子文件夹中生成页面 [英] Jekyll not generating pages in subfolders

查看:79
本文介绍了Jekyll不在子文件夹中生成页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用GitHub Pages,并在子文件夹中创建了一些页面.似乎没有生成我在子文件夹中创建的页面.所有其他页面都可以正常工作.目录结构是这样的:

I use GitHub Pages and created some pages in a sub folder. It seems to be not generating pages I created in sub folder. All other pages work fine. The directory structure is like this:

/
/index.html
/_config.yaml
/_includes
/_layouts
/_posts
/tag
/tag/personal.html
/tag/videos.html

/tag目录内的页面不是Jekyll生成的.同样,通常,如果Jekyll构建失败,则GitHub发送电子邮件,但在这种情况下不会失败.另外,如果我做任何其他更改,都可以使用,因此构建显然不会失败.

The pages inside the /tag directory are not generated by Jekyll. Also, usually GitHub sends an email if Jekyll build fails, but did not, in this case. Also, if I do any other changes it works, so the build is apparently not failing.

/tag/personal.html在这里:

---
layout: default
title: Tag-personal
permalink: /tag/personal/index.html
tagspec: personal
---
<div id="tagpage">
  <h1>Posts tagged personal</h1>
{% include tags.html %}
</div>

/_includes/tags.html在这里:

{% for tag in post.tags %}
  {% if tag == page.tagspec %}
    {% assign ispostviable = true %}
  {% endif %}
{% endfor %}

  <ul class="posts">
{% for post in site.posts %}
  {% if ispostviable == true %}
    <li><a href="{{ post.url }}"></li>
  {% endif %}
{% endfor %}
  </ul>

PS:我使用GitHub Pages,但是在我的开发计算机(Windows)上无法访问Jekyll实例.

PS: I use GitHub Pages and have no access to a Jekyll instance at my development machine (Windows).

推荐答案

我找到了罪魁祸首.正是在Jekyll v1.0中,引入了子目录中页面的绝对永久链接.在v1.1之前,它是可选的.但是从v1.1开始,绝对永久链接就退出了,这意味着Jekyll默认使用绝对永久链接而不是相对永久链接.

I found the culprit. It was that In Jekyll v1.0, absolute permalinks for pages in subdirectories were introduced. Until v1.1, it is opt-in. Starting with v1.1, however, absolute permalinks became opt-out, meaning Jekyll defaults to using absolute permalinks instead of relative permalinks.

页面是在/tag/tag/personal.html生成的,依此类推.

The pages were being generated at /tag/tag/personal.html and so on.

有两种解决方案:

  • _config.yaml
  • 中指定relative_permalinks: false
  • 进行相对于子目录的永久链接.

我选择了第一个选项.

这篇关于Jekyll不在子文件夹中生成页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆