jekyll , Jekyll display collection by category

Jekyll display collection by category


Tag: jekyll

I'm having trouble figuring out how to sort the content of a collection by category. I've found a very similar question on how to sort posts by category but it doesn't seem to work with collections Jekyll display posts by category.

Let's say I have a collection called 'cars' with two categories: 'old' and 'new'. How can I display only cars with the category 'old'?


You can sort, group or filter collection like any other object like page or posts.


category: 'old'
abbrev: tang
mustang content


category: 'new'
abbrev: vet
corvette content


{% assign newcars = site.my_collection | where: "category", "new" %}


{% assign allcarssorted = site.my_collection | sort: "category" %}


{% assign groups = site.my_collection | group_by: "category" | sort: "name" %}

This groups your cars and then sort groups by name that is the category.

{% for group in groups %}
    {{ }}
    {% for item in group.items %}


{{ content }} Liquid tag not showing blog posts

Link to repo: Hi all I am a beginner using jekyll and new to web development, so please be patient with me. I am coding my portfolio site, with a link to my blog. The fully processed portfolio site sits in _site/index.html which contains a link to the blog...

sorting of collection does not work

I have encountered a strange behaviour when I try to sort a collection. When I sort a collection with name "collection_name" by {% assign collection = site.collection_name | sort:"weight" %} there is no problem. All collections are available in site.collections and the same collection can be accessed via {% assign...

Jekyll “serve” command error: File to import not found or unreadable: base. Load paths: on line 46

First off, I have little Linux experience and no Ruby experience, however, I have googled and could not find an area like what I'm getting. Any help is appreciated. I apologize if this is not a good place to post this. I have installed Jekyll with the following, and only...

Grouping MarkDown elements in to DIV element or Custom html tag

I have used Jeykll tool to generate mark down content into HTMl . I want to group the below mark down elements in to div element or any other custom Html tag. Marked Down #Multiple Axis {:.title} Different types of data can be visualized in a single chart with the...

Github pages/Jekyll Coldfusion redirect

I've just moved my Jekyll site to Github pages, however I realised that I have a couple of Coldfusion redirects - e.g. http://mysite/index.cfm?page=disclaimer. These links are relied on from various locations on the web, is there anyway I can make it work? I have read up on Jekyll redirect-from plugin,...

Can you use Jekyll layout variables in pages?

In a Jekyll layout, default.html, you initialize a variable {% assign relative_path = "../../" %} Inside a page using default layout, this variable is empty though. How can you use inside pages variables set in layout? This is the opposite of Can you use Jekyll page variables in a layout?...

Cannot get assign where working in Jekyll template

I have built my website in Jekyll. The data file is working fine when parsed elsewhere, but when I try to access a particular record using a where clause I get no result. See the project at The troublesome page is under portfolio\betimca\index.html portfolio.yml projects: - name: "betimca" title:...

Baseurl behavior differs between localhost and github pages in Jekyll

I am developing a static site using Jekyll, to be deployed on github pages. I am facing issues using the baseurl in the configuration file. Here is an extract of my _config.yml: baseurl: "/blog" url: "" When ran locally at http://localhost:4000/blog/, everything is fine. The html pages are found, the...

Looping Previous and Next Post in Jekyll

My Jekyll based portfolio currently lists projects in chronological order. I'm using page.previous and to display the next and previous posts in my portfolio. When there is no 'previous' or 'next' project, there's a giant empty space. How can I modify: <section id="more-work"> {% if page.previous %} <div class="left">...

Dynamically add and filter images in Jekyll for github pages?

I am trying out Jekyll to help someone who's not all that technical maintain their own static site. I would like to be able to have a images directory in the app's root /images containing images following a naming convention: post_one_1.jpg, post_one_2.jpg, post_two_1.jpg, post_two_2.jpg ... etc. I would then like...

Jekyll and Liquid for-loop

I want to create a little side navigation vor on-page navigation. The site contains multiple images one above the other, the navigation is inside every single image and is linking to the individual id's. I am using jekyll with the liquid templating engine. To not hard code every single element...

Jekyll: including a post inside another post

Does Jekyll provide a way to include a post inside another post? I know that sounds a bit goofy, but I'm using it for a cooking/recipe site. Some of my recipes are made up of components, or other, smaller recipes. I'm looking for a way to include a handful of...

Index page retrieve variable from all posts

I have a Jekyll based blog that has some location data in the frontmatter of each post. For example: mapping: locations: - title: Times Square latitude: 40.758885 longitude: -73.985134 - title: Central Park latitude: 40.782841 longitude: -73.965350 I would like to retrieve all the locations in all of my posts...

Jekyll build stuck in “Rebuilding index…” stage

I've just built my first Jekyll website, and (almost) everything was going fine, until I added a few (around 80) old posts from my previous website. Now, when I try to run Jekyll to serve the website locally, it starts, but stay stuck in the Rebuilding index… stage: $ ./

Can I change Jekyll's temp directory?

Can I change the directory Jekyll uses for it's temporary building? I'm using Jekyll on a gh-pages branch and when I switch back to my Ember project on master, it puts new files in /tmp. This causes problems with Jekyll's build, and forces me to delete the dir each time...

How to iterate through the top 3 posts from the last two weeks in liquid/jekyll?

Let me add some context: i'm trying to automate my boring reports to management using jekyll! I'd like to write a post for every activity i do and, every week, ship the compiled report with the "top 3 highlights" from this week and from last week. My shot at it,...

Jekyll redcarpet render Table with frame

I had the same problem as in Table not render when use Redcarpet in Jekyll GitHub Pages? And I used the answer to get table rendering into my github Jekyll page. But it does not render the frame or lines of the table. Is there the possibility to get a...

Styling Jekyll website with Bootstrap

I am trying to set up a website using Jekyll and GitHub Pages (first-timer), and most importantly, to style it with Bootstrap. You can check what I have already done: GitHub repository: GitHub page: (check gh-pages branch) Also, I followed this tutorial to import Bootstrap into the Jekyll...

Jekyll raw HTML in post

I have a Jekyll website, with Posts written in Markdown using the Kramdown parser. I would like to add some raw HTML within the post. However when I try to add the HTML, it parses it as markdown (changing <'s to &lt; for example). I have tried: Adding the HTML...

Why is the site.categories array not being output in Jekyll?

I'm building pages (not posts) in Jekyll. One page defines 2 categories in the front-matter as follows: categories: [document, new] And then in a layout I'm trying to output the categories object/array, but nothing is being output: <h1>Array: {{ site.categories }}</h1> Why wouldn't this output an array as expected?...

How to deal with the inconsistency between the posts file and the actual webpage on github?

everybody, I am new to github and build a simple blog on it. However, when I add a new file to the posts directory, the actual website will not always be updated immediately(sometimes it does), I thought it is because of the cache of the Chrome, but after I cleared...

How to concatenate the value of iterator inside liquid tag (Jekyll)

I am looping through a Yaml object and need to append the value of 'i' to the address the proper object. <div class="chapter"> {% for i in (1..7) %} <strong class="title">{{ page.chapters.title + i }}</strong> <ul> {% for topic in + i %} <li> {{ topic }} </li> {%...

With Jekyll, links inside SVG graphics aren't working

I have an SVG graphic in a Jekyll project with code like this: ``` <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <svg version="1.1" xmlns="" xmlns:xlink="" x="0px" y="0px" viewBox="0 0 451.5 100" enable-background="new 0 0 451.5 100" xml:space="preserve"> <a xlink:href="">...

Error when running jekyll docker container with boot2docker on Mac

I am running docker on my MBP (Yosemite 10.10.3) with boot2docker (v1.6.2). When I try to run docker run --rm -v "$PWD:/src" grahamc/jekyll build (without sudo) I got the following error: twer$ $(boot2docker shellinit 2> /dev/null) twer$ docker run --rm -v "$PWD:/src" grahamc/jekyll build /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/spec_set.rb:92:in `block in materialize': Could not...

Unable to set favicon using Jekyll and github pages

I am trying to set a favicon.ico for my github page, but it doesn't work. When I serve it locally I see the standard "empty" favicon and when I push it I see the facebook icon. Why is it so? I have the right favicon.ico in the root directory of...

jekyll markdown bullet point issue

I am editing my markdown in some online editor Then copying the content into jekyll _posts. However, the jekyll is rendering on the browser differently that what I am seeing in above mentioned editor/github preview of the file. The major problem I am facing is with the bullet points....

travis-ci : error during the build (No such file or directory)

I'm having a problem trying to test my build on travis-ci for my jekyll app. One of the plugins generates a json containing informations that my app can reach for a search tool. The build command works fine on my computer : bundle exec jekyll build --source octopress Witch indexes...

Markdown compiling images with paragraph tags

This is just a simple problem but it's one that I can't find on Google to solve this. Basically what is happening is that I have a Jekyll website, and I'm using kramdown for the markdown compiling. When I add an image to a markdown file like below: ![Image Alt...

Run PHP code on local MacOS Jekyll site, port 4000

I've build a Jekyll website on my localhost (MacOS Mavericks). The website is served at http://localhost:4000/website/ and everything regarding Jekyll is running just fine. However, I now want to have a contact form in PHP that allows me to receive emails. I placed a contact.php file in the website/ folder...

Configure generating path with Jekyll

If there are files called members/ and members/, the Jekyll generated position will be members/alice.html and members/bob.html. How can I set them to be members/alice/index.html and members/bob/index.html?

Github pages css troubles only on smartphone

I am creating a website using Jekyll, and publishing it using Github pages. When I jekyll serve the website in local, everything works fine, and it looks normal both from my computer and smartphone. But when I visit the Github pages one from my smartphone, some divs seem to be...

Jekyll posts filenames without dates

I don't care about dates because I edit my previous posts all the time, so I would like to replace _posts/ by _posts/

Markdown link escaping layout

I have a website I am making with Bootstrap and Jekyll. I recently ran into a problem where, on blog posts, if an author's name is hyperlinked (to a Google+ profile, for example), a snippet of html is displayed above the body as if the HTML syntax is broken. I'm...

Stack overflow after adding jekyll to the gruntjs setup generated by yeogurt

I used yeoman yeogurt generator to kickstart my project. The grunt file generated uses (to the best of my knowledge) include-all and grunt-jit to load the modules. What I would like to do, is add the building of jekyll to this file. To do this I installed grunt-jekyll. Afterwards I...

Jekyll Config Multiple Files

As the doc mentions, we should be able to write: jekyll build --config "_config.yml, _config.en.yml" Instead, I receive: Fatal: The configuration file ' _config.en.yml' could not be found. While the file actually exists. What am I doing wrong?...

Change deep_merge to Utils.deep_merge_hashes

I am using Octopress to generate static html pages. I tried to change the language of the dates using this instruction (it is in German but we need only the code). When I copy date.rb from these German website to my octopress/plugins, I have the following error: Liquid Exception: undefined...

How to show only specific post in Jekyll?

I'm trying to use Jekyll for creating a simple single page web site. This website will further be used for creating posts like content blocks. But in my Jekyll I want only show certain posts and not all of those available. How to can I get certain specific post, without...

Jekyll's is removing static file during cleanup

I want to include a gnuplot code inside a markdown page and have Jekyll compile the graph when I save it. The graph image is being saved. But it is removed during jekyll's cleanup. The closest that I have found toward a solution is at Copying generated files from a...

Adding Jekyll to an existing website

I have a simple website and tried to add a Jekyll blog in it in a new folder blog thus I have run jekyll new blog in the folder /path. However when I'm running the command jekyll build in /path I have these errors: $ jekyll build Configuration file: none...

Can I use {{}} with a Collection has format in Jekyll?

From the document I read on Jekyll and around the Internet, posts in _posts directory is in format and their date can be retrieved by using {{}} Liquid variable without the need of specify a YAML front matter "date". However, I created a Collection at the same level of...

How do I prevent Kramdown from getting confused by a C++ include?

I have written this plugin: module Jekyll module Tags class Prism < Liquid::Block def initialize(tag_name, text, tokens) @arg = text.strip super end def render(context) output = super(context) "<pre><code class=\"language-#{@arg}\">#{output}</code></pre>" end end end end Liquid::Template.register_tag('prism', Jekyll::Tags::Prism) This is how I use it: {% prism cpp %} #include <iostream> // Hello World...

Jekyll - How can I make avoid a paragraph to be added on a YAML frontmatter markdownify item

Okay... I have a project where I'm using Jekyll for a podcast project. And I chose to list the hosts in the shownotes by a YAML Front Matter item: hosts: - Name A - Name B - Name C Using this piece of code <li> <strong>Hosts:</strong> <ul> {% for host...

Show only headers in Octopress RSS

I have a blog based on Octopress. It generates an RSS-feed, but that feed contains whole pages (posts) with images included. How can I "shrink" it, so it would contain only headers of pages (posts)? Octopress: 2.0 Jekyll: 2.0.3...

Error when run jekyll server on windows 7

I'm trying run Jekyll server in my local machine, so when I run jekyll server in terminal, returning fallowing message: $ jekyll serve Configuration file: C:/xxx/Site/_config.yml Source: C:/xxx/Site Destination: C:/xxx/Site/_site Generating... c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/posix-spawn-0.3.11/lib/posix/spawn.rb:164: warning: cannot close fd before spawn 'which' não é reconhecido como um comando interno ou externo, um programa...

Latex \newcommand in kramdown

I understand that cramdown does not support \newcommand type macros. Is there a workaround that does not involve Pandoc, so that it could be used with Jekyll in a GitHub blog? This would be the input markdown: --- layout: post --- \newcommand{\a}{\alpha} This is a test $$\a$$. The output should...

How to pass parameters to RedCloth (Textile processor) from Jekyll

The RedCloth FAQ describes using the fold_lines option to disable hard breaks. What's the easiest way to pass fold_lines to RedCloth when it's called as part of Jekyll's build process? (am I just missing something in the Jekyll configuration guide?...

Jekyll post not generated

I am trying to add a new post to my Jekyll site, but I cannot see it on the generated pages when I run jekyll serve. What are some common reasons for a Jekyll post to not be generated?...

What does {% capture var %} do in jekyll?

What does {% capture var %} do in jekyll? Can I for example, in a .md file do: {% capture head %} I am the head {% endcapture %} and then in the .html file do: {{head}} Am I using capture correctly? Sorry, I couldn't find any documentation on capture....

Jekyll: Using liquid tags in .md files

I am working on a project using Jekyll. Looking online, it seems that it is possible to use liquid tags in a markdown file. For some reason, the liquid tags are not working in my markdown files. I want to use the liquid "capture" tag to store text in a...

Jekyll include variables from external file

With Jekyll, I know you can include a variable in the include line, like so: --- layout: default testVar: test1 --- {% include test_block.html testDivContent=page.testVar %} Is it possible to include another file that passes in the variable content (in this case testVar: test1) from an external file? So something...