Closed juzraai closed 8 years ago
This looks promising, I take it you assign category_root
; or is it a jekyll feature?
The other question I have is which versions of Jekyll this has been tested up to and what config.yml looks like in the case you have two slashes?
This looks promising, I take it you assign category_root; or is it a jekyll feature?
I assigned it :) in category_pages.rb
on lines 19 and 22.
which versions of Jekyll this has been tested up to and what config.yml looks like in the case you have two slashes?
I used the default config.yml:
title: Your awesome title
email: your-email@domain.com
description: ...
baseurl: ""
url: "http://yourdomain.com"
markdown: kramdown
With Jekyll v3.1.6 and your code, the generated HTML looks like this:
<ul class="posts">
<h2><a href="/categories//jekyll/">jekyll</a></h2>
<h2><a href="/categories//update/">update</a></h2>
</ul>
But now I've tried with Jekyll v2.3.5, and here your code works well:
<ul class="posts">
<h2><a href="/categories/jekyll/">jekyll</a></h2>
<h2><a href="/categories/update/">update</a></h2>
</ul>
Strange... my code fixes double slash in Jekyll v3.1.6 but creates a mess in v2.3.5.
I've just added a new commit which uses Liquid filters to add the slash, and then replace double slash with a single one. I tested it in both Jekyll v3.1.6 and v2.3.5, it works well:
<h2><a href="{{ page.url | prepend: base_url | replace: "/index.html", "" | append: "/" | replace: "//", "/" }}{{ taxonomy }}/">{{ taxonomy }}</a></h2>
Thank you very much :+1: . It's true, I think I wrote this pre 3.x :wink:
category_root
variable helps layout to decide whether to render a category list or a post list - without knowing the title of the category list page (old version). This way, title of the category list can be edited at only one place. :)Also there was an extra slash in taxonomy link which produced a "/categories//category-name/" like URL.
Awesome plugin anyway! :)