Update: Check my answer below.
I just realized that in Jekyll Webrick server, directories starting with underscores(_includes, _layouts etc.) can't be accessed and are not listed when jekyll serve --show-dir-listing option is turned on. I wonder how Jekyll does that, as Webricks shows underscored directories on default. I did a quick search in the source code, I checked lib/jekyll/commands/serve.rb and similar files, but could not find the exact reason. It might be something related to fancy_listing?


Update: I found the relevant code in
jekyll/reader.rb, which has a filter function and it is defined injekyll/entry_filter.rb! :) Here is the code:special?function is defined:And
special?function is used in the filter function to detect and filter those files matching the regex.And the
Readerclass is using this filtering function in various places.To be honest, I still did not get how jekyll bring those things together but I think I'll try to figure them out myself.