Jekyll-archieves, trace tags in other folder - jekyll

I tried to use Jekyll-archieves to generate the tags index in _sites by using the following
jekyll-archives:
enabled: [categories, tags]
layouts:
category: category
tag: tag
permalinks:
tag: /tags/:name/
category: /categories/:name/
But I found it only works for the markdown files in _posts folder. Currently, I have created separate folders for different markdown files by using permalink , for example, I use a 'work' folder to store all work-related markdown files and a 'travel' folder to store all travel-related markdown files, like this. How should I modify the above codes so that the jekyll-archives can trace all tags?

Related

pandoc - how to generate hugo-like section page?

In hugo a section page is file _index.md and by default this page is a type of list, ie. it would have URL links to other files/pages in same directory.
How would I do that with pandoc. Let's image I have a directory named fruits and with a file named _index.md which would have some content in markdown. Then there would be multiple markdown files, each corresponding to a fruit type - subpages in the same directory.
How to get list of all markdown files except _index.md in the directory, title from each markdown file's frontmatter, and how to construct a code being merged into section's _index.md?

Jekyll: use regex/wildcards in _config.yml?

I'm organizing my images and other assets with one directory per post, like this: /assets/blog/[post date]/. I'm using a responsive image plugin, so I can exclude images in that folder from the build like this:
exclude: ["/assets/blog/*.jpg", "/assets/blog/*.png"]
Now I also have assets that are not parsed by the plugin (OG and Twitter card images), so I need those to be copied to the build. How can I add a pattern for those files to include those files?
Example:
Exclude all images in /assets/blog/ and its sub directories, except those in /assets/blog/[date]/OG-And-Twitter/
I tried to use regex:
exclude: "/assets/blog/????-??-??/[\w|-]+.png"
But that didn't work.

In Jekyll is there an easy way to change an output path for a folder with html

I am using Jekyll for some static site templates and I have a folder of product html pages which I want to be bundled into the root site/ folder rather than into a site/products folder.
example below with just 2 product pages:
src folder
src/products/123.html
src/products/146.html
output to site
site/123.html
site/146.html
Is there an easy way to do this?
Additionally would there be an easy way to append products- to each file in this folder?
site/product-123.html
site/product-146.html
Try looking into Jekyll collections. You'll specifically want the Permalink feature. Hopefully the following snippet will get you started.
config.yml
collections:
products:
output: true
permalink: /product-:title/
source tree
_products
|
1.html
2.html
3.html
...
output tree
_site
|
product-1
|
index.html
product-2
|
index.html
product-3
|
index.html
...
This creates the "pretty permalinks" structure where file endings are removed by using index.html within a directory of the correct name. Of course you could set it to create the "ugly permalinks" (project-1.html, etc), but I like this style more.

Jekyll: All HTML files in /folder, now forced rendering through /folder/page/. How to change?

So I've tried looking here:
http://jekyllrb.com/docs/permalinks/
and here:
Show pages under one folder in Jekyll?
But this doesn't seem to resolve my issues.
So here is the situation:
Initially, I had all my Jekyll *.html files living in the /root folder of where I am running Jekyll, this was a bit messy, as there was over 30 *.html files, but when I did this:
jekyll build
jekyll serve
I would get the site propagating to: http://0.0.0.0:4000/
I now moved all the *.html files to a folder called /html (within the project root). When running:
jekyll build
jekyll serve
My site no longer renders at: http://0.0.0.0:4000/
But it renders at: http://0.0.0.0:4000/html/
I would like to remove the /html part of the URL, but as the above 2 links show, there was no previous question related to this.
Can anybody suggest how I can remove the /html part from my URLs?
Okay, so initially your folder structure looked like this, correct?
/_layouts/default.html
/css/whatever.css
/index.html
Now to your question:
Do you want to move the HTML files and nothing else to the html subfolder?
In other words, do you want to do this?
/_layouts/default.html
/css/whatever.css
/html/index.html
If yes, read David Jaqcuel's answer.
If not, continue reading my answer :-)
Or is it just that you don't want all your source files cluttering up your root folder?
If yes, you could move everything into the html subfolder, like this:
/html/_layouts/default.html
/html/css/whatever.css
/html/index.html
Then you need to tell Jekyll that the html folder is the root folder for the site's source files.
To do so, you need to add the following line to the config file (or create the file if it doesn't exist yet):
source: html
Important: the config file needs to be in the root folder of your project, even if you move your source files into a subfolder!!
Then all your source files are in the html subfolder, but the generated site will look like this:
/_layouts/default.html
/css/whatever.css
/index.html
In other words, the URL will still be http://0.0.0.0:4000/.
If you want to see an example, you can look at the source code of my blog:
I'm doing exactly the same there, only that the folder with the source files is called src.
By default, for pages in /html, Jekyll will generate a page like /html/page.html and so on.
I think you cannot add a permalink front matter default for a folder, you'll be obliged to set a permalink for each page you put in /html.
eg : for html/page.hmtl, you'll have to set :
---
permalink: page.html
---
This is the way without plugin. Otherwise, you can do it with a Generator plugin that will take all your pages in /html and change the all the target permalink.

Custom permalinks for documents in Jekyll collections

I want to add collections to my Jekyll site. In my _config.yml file I set output: true:
collections:
faq:
output: true
In my source folder I added _faq folder and created a file named 1.md in it.
When I generate the site I can see my document at http://localhost:4000/faq/1.html. But when I customize the permalink for this document and add permalink: /faq/1 in its YAML front-matter, it doesn't display at http://localhost:4000/faq/1 and downloads to the computer instead.
Is there any way to customize permalinks for documents in Jekyll collections (to show without .html extension)?
The permalink should be permalink: /faq/1/, then it works.
Permalink should be permalink: /faq/:path/
That will set the correct relative path for all files and subfolders of that collection and drop the .html suffix.