jekyll: [Bug]: `include` option ignores folders

Operating System

Windows 11

Ruby Version

ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x64-mingw32]

Jekyll Version

jekyll 4.2.2

GitHub Pages Version

No response

Expected Behavior

Given this source folder:

excluded/
    included/
      this-file-should-be-included
_config.yml

with this _config.yml:

exclude:
  - excluded

include:
  - excluded/included

When running bundle exec jekyll build, I expect the following output:

_site/
  excluded/
    included/
      this-file-should-be-included

Current Behavior

The current implementation produces an empty _site folder.

Note that if the include option points to the file explicitly, the file is included as expected

Relevant log output

No response

Code Sample

Steps to reproduce issue

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 2
  • Comments: 20 (5 by maintainers)

Most upvoted comments

I accidentally stumbled upon the solution.

Case 1

My folder structure looks like this:

_posts/
    included_folder/
        post1.md
        post2.md
    other_folder/

The working config specifies the relative path from the _posts folder, not from the project root directory (which is a weird behaviour that should be changed).

exclude:
  - "_posts"

include:
  - "_posts/included_folder" # does not work
  - "included_folder" # does work

Case 2

folder structure:

_posts/
    excluded_folder/
        included_folder/
            post1.md
            post2.md
        other_folder/

config:

exclude:
  - "_posts/excluded_folder"

include:
  - "_posts/excluded_folder/included_folder" # does not work
  - "excluded_folder/included_folder" # does work

Edit: updated to add more specific cases

It sure does love to come mark this stale. I worked around it though with this to dynamically populate the include list everywhere there was a .nojekyll file. Which isn’t great, but it works for me to get around this issue until it’s fixed.

Not stale!