16

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

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.

The /tag/personal.html is here:

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

and /_includes/tags.html is here:

{% 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: I use GitHub Pages and have no access to a Jekyll instance at my development machine (Windows).

0

2 Answers 2

15

Joshua Powell provided step-by-step directions in reply to a similar question on Github.

  1. Edit _config.yml to add the following line (or expand the array, if it exists)

    include: ['_pages']

    where _pages is the name of the folder in which you wish to keep your files. (This also works for nested folders if you explicitly add them, e.g., ['_pages', '_pages/foo'].)

  2. Move your pages into that folder. (These pages may be HTML, Markdown, or whatever else Jekyll renders when it’s placed in the root folder.)

  3. Give them front matter with an appropiate permalink including a trailing slash, e.g., permalink: "/about/".

2
  • 1
    This didn't work for me. :( The pages aren't being generated as they were when the files were placed in the root.
    – Ellesa
    Jul 15, 2016 at 13:32
  • 1
    Thanks! the link to the GitHub issue on Jekyll made my day !! Mar 25, 2019 at 20:10
13

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.

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

There were two solutions:

  • Specify relative_permalinks: false in _config.yaml
  • Make permalinks relative to the subdirectory.

I chose the first option.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.