Keep Jekyll output files from permalink generation - jekyll

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, ...]

Related

How to recursively include only markdown in a directory in Jekyll

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.

Jekyll: Manually whitelist directories and files to be copied to _site directory

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.

How can I "watch" multiple source directories in Jekyll?

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.

Adding non-text files to `_posts` in Jekyll

Short story: I want to be able to store non-text files/directories in the _posts/ folder.
This is not about local assets, or anything like that. I literally just want to store files (non-associated images and directories) there for a specific, unrelated issue that doesn't merit discussion.
Is there a way to put a folder in _posts/ and in essence have Jekyll ignore all of its contents? Or at least, not freak out about the contents being non-text files?
EDIT: It seems that the actual errors are coming from the names of some of the sub-subdirectories. When the name of these directories start with a date, it gives me the error:
Liquid Exception: invalid byte sequence in UTF-8 in /Users/burchill/burchill.github.io/_posts/blah/source/2017-1‌​0-28-blahblah_post/b‌​lah.png
EDIT #2: After changing the directory names to "play nice" with Jekyll's regex, Jekyll no longer gives an error, but when I try to link to these images on my posts, they don't show up, unlike files in other non-_posts directories.
Jekyll won't process files not starting with the triple dashes block (frontmatter) so it is safe to have any other file in your _posts folder.
https://jekyllrb.com/docs/frontmatter/

What's the correct wildcard syntax to copy TeamCity artifacts to the root of a destination path?

I'm having a small drama with the wildcard syntax in my TeamCity artifact configuration. I want to grab every file matching the pattern myproject.*.dll from any folder and place each DLL in the root of the artifacts path.
Here's what I've got at present:
**/obj/Debug/myproject.*.dll => /
This is grabbing all the DLLs but it's putting them inside the same folder structure as the source so rather than ending up with "myproject.web.dll" in the artifacts I get "Web/obj/debug/myproject.web.dll".
What am I missing here?
I'm afraid you cannot do this in an easy way.
You should collect your *.dll locally to a single place, and than use TeamCity's artifacts rule to copy all of them to root directory.
Or, you can enter all paths manually (without ** part)
This is how it works in TC.
I am not sure you can use the artifact root without it copying the structure. The docs specify
If target directory is omitted the
files are published in the root of the
build artifacts.
Can you not just use a designated folder name say dist, would this cause issues? If so what are they!
e.g
**/obj/Debug/myproject.*.dll => dist
Update - found some more info in the docs
The files will be published preserving
the structure of the directories
matched by the wildcard (directories
matched by "static" text will not be
created). That is, TeamCity will
create directories starting from the
first occurrence of the wildcard in
the pattern.
So if you can be more explicit it may lead to a flatter structure.