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
If anyone, like me, is looking to include several source folders in github-pages, you can simply configure the jekyll root in github-page on the master branch. I.e. not on gh-page branch, nor on the docs folder.
Thus, all folder is processed. README.md are treated as index.md and you can easily make relative links from the main README.md at the root to any other doc which are "below" it in the file hierarchy. Thus having jekyll cover all your code documentation.
Related
I need to put the files in a src folder, is that possible, will Github actions be able to see the files.
No, you cannot do this. It’s completely locked to that folder.
Only for action.yml files this is allowed (can be put anywhere, but then you do have to reference them differently with the full folder path).
I am putting the general project documentations together with some project source files and rendering that to gh-pages with Jekyll. For security reasons and building time optimization, I want to exclude everything inside my source directory except markdown files in Jekyll configuration.
I tried this in the _config.yml:
exclude:
- "src/*"
include:
- "src/**.md
but it doesn't seem to find the nested markdown. I wonder how should this properly get done.
Is it possible to specify a list of files or directories that one would like copied to the _site directory? I would like to copy those files as is, in the way the webpack-copy-plugin lets one use webpack to copy files from on place to another.
The files I want to copy are in _includes, in case this complicates things. I know I could make a top level directory in my project for these files I want copied to _site, but I want to keep things tidy and place everything in _includes (Jekyll already makes lots of files and folders in my project root, and I don't want any more).
I tried specifying the value for include in _config.yml, but this doesn't seem to be copying file to _site.
Any suggestions others can offer would be helpful!
Curious, specifying in _config.yml:
include:
- _includes
Copies over everything from _includes, while specifying:
include:
- _includes/assets
does not copy over anything. I'll just use the former.
I have a _posts folder that contains all my posts for my blog and projects. I'd like to separate the markdown files for my blog notes and project pages. For example, in addition to the built-in md -> HTML conversion for files in _posts, I'd like to have a _projects folder that contain my markdown files for individual project write-ups and build them into HTML when running jekyll serve.
just define a collections key in your _config.yml:
collections:
projects:
output: true
Official docs for more info..
Looks like you want to use categories. Here is a link discussing a similar problem : Multiple _posts directories
By default Jekyll will ignore new folders with an underscore prefix, so you can't use _projects.
You can separate _posts in several folders, to have all your project files in a specific folder, create projects/_posts folder structure and move your project files inside projects/_posts, leaving blog posts in _posts.
Jekyll will generate each post and automatically assign the project category to them, so you can also generate different lists from your blog posts.
I have one page - hello.html. For this page i have two languages which are defined in a config file. Also i have two different output directories configuration, different the original file name - en/ and pl/. Now, i can generate one lang by dedicated config, after this i can do this for second one.
My question is how to keep en/ directory when i'm generating pl/ one and reverse, how to prevent removing them form public output directory?
Using keep_files jekyll config feature is not working because output directory/file name is different then original.
Hope that this is clear enough.
If you don't mind having two config files, exclude the en files in your pl config, and vice versa. For example, in your pl _config.yml:
exclude: ["en"]
In your en _config.yml:
exclude: ["pl"]
From https://jekyllrb.com/docs/configuration/:
Exclude
Exclude directories and/or files from the conversion. These exclusions are relative to the site's source directory and cannot be outside the source directory.
exclude: [DIR, FILE, ...]