jekyll,liquid , How to reference properties in liquid

How to reference properties in liquid


Tag: jekyll,liquid

I have a Jekyll template pulling in text from data objects.


{% for speaker_hash in %}
    {% assign speaker = speaker_hash[1] %}
      <div class="speaker">
        <img class="head" src="/img/2015/speakers/sample.jpg">
        <h2> {{}} </h2>
{% endfor %}

However I would like to have each page specify what year its for with a page.year property.

Is it possible to create the same for loop but specify the year dynamically?


 {% for speaker_hash in[page.year].speakers %}


Answer yes.

1 - Your page.year must be a string as hash indexes are strings. So in you front matter : year: '2015'

2 - Get speakers depending on page.year :

{% for speaker_hash in[{{page.year}}].speakers %}


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

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

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?

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

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

Shopify: how to add a class depending on collection

On a clients homepage they want 'all the products' listed with a load more button at the bottom. There are four categories and each has a different color associated. I want to pull in all the products by date listed order and apply a class to the product depending on...

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

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

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

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

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

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

Shopfy accessing all products from a collection on the product page

I'm using Shopify as my eCommerce platform. My customer has some products that are related to each other. But don't think of a typical related products system, basically these products have parts, and those individual parts can be reordered separate from the product itself. The client wants to list all...

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

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

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

Is there a way for concatenate two strings and then process the result inside the Output tags not as a string?

Here's what I am trying to accomplish: <ul class="site-nav__dropdown"> {% for childlink in linklists[child_list_handle].links %} this - {% assign color_from_settings = 'settings.collection_color_' | append: forloop.index %} used here - <li{% if %} class="site-nav--active" {% else %} style="background-color: {{ color_from_settings }}" {% endif %}> <a href="{{ childlink.url }}" class="site-nav__link">{{ childlink.title...

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

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

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> {%...

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?...

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

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

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

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: 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...

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

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

{{ 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...

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

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

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

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

Shopify vendor if statement

A shopify liquid question: If no vendor is available, then shopify adds the shop name as the default vendor. I'd like those instances to be blank. I'm trying to create an if statement which hides the vendor if there is no vendor or if it equals the default vendor name....

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?...

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?...

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

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

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