I'm pretty sure I've seen in Jekyll blog projects with multiple source document directories, such as _posts
and _pages
, but the source
parameter in the _config.yml
file can only take 1 directory as its argument, and neither an array nor a space separated string of directories works.
Am I misunderstanding the meaning of the source
parameter? I'm expecting it to be used by watch to specify which files' changes will trigger a build, and which files to build.
Also, I have fragments such as about.md
which can be included in other pages. What is the best location for files like this one?
The source
configuration refers to your <project_root>
, not individual directories within the project root. By default, its set to your current_directory (the location from where you are running jekyll build (or) serve
.
Jekyll watches all nested files and directories deep within the source directory by default.
about.md
is not meant to be seen as a fragment to be included in other files. Its a full-blown "page" that would render into _site/about.html
or _site/about/index.html
depending on your permalink settings.
Fragments to be included in other pages live inside the _includes
directory and are inserted via the Liquid construct {% include <fragment-filename>.html %}
Other than _layouts
, _includes
and _sass
, directories that start with an underscore are ignored by Jekyll unless you configure Jekyll to see them as "collections". _posts
is a pre-defined and hard-coded collection directory.
For more information on Jekyll, refer the official documentation at https://jekyllrb.com