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-10-28-blahblah_post/blah.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/
Related
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'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.
I first met html-minifier today after running a small site I've created using Hugo through Google PageSpeed.
First thing I noticed is that although it does have recursion capabilities it stops working on unsupported files like images (my speakers started beeping and I freaked a little)
I've found this stack showing an apparently undocumented command-line option --file-ext
That worked perfectly but in the output directory, I noticed that the folders with the unmatching contents were gone.
From the directory root, I saw it was Hugo's folders for CSS, JS, images and Github Pages' CNAME file. Not only I can't tell for sure there's not even one piece of static file in any of the folders Hugo generated (you may know that Hugo is sometimes unpredictable) but also I would like to keep language specific XML Sitemaps I've created for some specific folders.
Long story short, is there a way to copy-over unmatching files "as is", keeping input directory ready for a commit/push?
After analyzing the whole directory structure I could be sure that within all the directory structure Hugo creates there are nothing more than HTML and XML files so then the Ockham's Razor took place.
Since both my Hugo's source code and output contents are in totally different directories, it was a simple matter of pointing the output directory to the same path of the input directory.
All HTML files are minified, overwriting those Hugo generated.
I am looking for a way to ensure that upon build a PDF will end up in a specific directory. I am using the jekyll-pages-directory plugin to create the structure of this site. Not looking to embed the PDF in a page, not trying to link to it from my assets folder. Need it to have a URL of that places it within a specific path without redirects.
When I place the PDF into the directory inside of the pages folder I get errors from Jekyll about it not being a valid byte sequence. I assume that this means Jekyll doesn't know how to handle the file type. The Error is as follows:
Error reading file /Users/path/to/site/_pages/path/to/my.pdf: invalid byte sequence in UTF-8
Liquid Exception: invalid byte sequence in UTF-8 in path/to/my.pdf
jekyll 2.5.3 | Error: invalid byte sequence in UTF-8
So in short how can I make Jekyll place my PDF into the correct directory in _site upon build so that I can control what its url would be?
I have a _posts folder and I just want a simple way to separate the posts in the folder into two different folders, and not have any permalink changes, for purely organizational reasons.
Just create subdirectories in your _posts directory; the subdirectories will be ignored when Jekyll generates permalinks.
I recently did this to my _posts folder because I have over 200 files. I decided to create folders that represent each year I have a posts for. Doing this though, broke post_url. The error is something like as follows when you run jekyll build
Liquid Exception: Could not find post "blah-blah" in tag 'post_url'. Make sure the post exists and the name is correct. in _posts/2007/blah-blah.md
I had to go back in and where ever I used post_url, I had to add /year/ in front of each post url links.
https://github.com/jekyll/jekyll/issues/1714#issuecomment-28167702