Jekyll is a blog-aware, static site generator in Ruby Jekyll • Simple, blog-aware, static sites

Sorted navigation menu with Jekyll and Liquid

I'm constructing a static site (no blog) with Jekyll/Liquid. I want it to have an auto-generated navigation menu that lists all existing pages and highlight the current page. The items should be added to the menu in a particular order. Therefore, I define a weight property in the pages' YAML:

layout : default
title  : Some title
weight : 5

The navigation menu is constructed as follows:

  {% for p in site.pages | sort:weight %}
      <a {% if p.url == page.url %}class="active"{% endif %} rel='nofollow' href="{{ p.url }}">
        {{ p.title }}
  {% endfor %}

This creates links to all existing pages, but they're unsorted, the sort filter seems to be ignored. Obviously, I'm doing something wrong, but I can't figure out what.

Source: (StackOverflow)

What is the difference between, and localhost?

I am using Jekyll and Vagrant on my mac. I found that Jekyll server will bind to instead of Also gem server will bind to this address by default. I can still visit it via http://localhost:port. But for Jekyll, it seems that the default setting (e.g. requires Internet access. I cannot run Jekyll server without Internet. Is it a small bug?

I also use Vagrant. I have set port forwarding(8080 => 4000) in Vagrantfile, since I install Jekyll in Vagrant virtual machine and test it under Macintosh. If I use the default setting (, it works. I can visit it from my safari with http://localhost:8080. But if there is not internet, I cannot bind to I use jekyll server -H to bind service to instead, then I cannot visit it via http://localhost:8080.

Can anyone explain the difference between, and localhost? And can anyone explain why the difference will cause this problem?

Source: (StackOverflow)

Jekyll select current page url and change its class

I've been using Jekyll for a static site (so that its easy to maintain), and have been stuck at the following feature :

This is my link bar :

<ul id="links">
    <li class="first"><a class="active" rel='nofollow' href="/">Home</a></li>
    <li><a rel='nofollow' href="./associate.html">Associate With Us</a></li>
    <li><a rel='nofollow' href="./media.html">Media</a></li>
    <li><a rel='nofollow' href="./clients.html">Clients</a></li>
    <li class="last"><a  rel='nofollow' href="./contact.html">Contact Us</a></li>

The active class handles the coloring. What I want is this class be applied by jekyll depending on some variable set using liquid/YAML.

Is there some easy way to go about this?

Since the bar is common to all the pages, it is now in the default layout. I could go around by using Javascript to detect the url, and do the highlighting but was wondering if there was any way of doing this in Jekyll.

Source: (StackOverflow)

Github flavored Markdown and pygments highlighting in Jekyll

I've deployed my Jekyll blog on a VPS. I would now like to add Github-flavored Markdown to it, using Pygments highlighting, but I don't know which files do I have to edit and how.

So far, the only file I've configured is _config.yml wich looks like this:

  1 safe:        false
  2 auto:        false
  3 server:      false
  4 server_port: 4000
  5 baseurl:    /
  6 url: http://localhost:4000
  8 source:      .
  9 destination: ./_site
 10 plugins:     ./_plugins
 12 future:      true
 13 lsi:         false
 14 pygments:    false
 15 markdown:    maruku
 16 permalink:   date
 18 maruku:
 19   use_tex:    false
 20   use_divs:   false
 21   png_engine: blahtex
 22   png_dir:    images/latex
 23   png_url:    /images/latex
 25 rdiscount:
 26   extensions: []
 28 kramdown:
 29   auto_ids: true,
 30   footnote_nr: 1
 31   entity_output: as_char
 32   toc_levels: 1..6 
 33   use_coderay: false
 35 coderay:
 36   coderay_wrap: div
 37   coderay_line_numbers: inline
 38   coderay_line_numbers_start: 1
 39   coderay_tab_width: 4
 40   coderay_bold_every: 10
 41   coderay_css: style

How do I properly configure Jekyll to use Github flavored Markdown and Pygments highlighting?

Source: (StackOverflow)

Highlight with Jekyll and pygments doesn't works

I want to use pygments with jekyll

In my code I have the following:

{% highlight java %}
NullPointerException at org.springframework.core.GenericTypeResolver.getTypeVariableMap
{% endhighlight %}

I generate my site with jekyll --pygments and the html result is:

  <pre><code class="java">NullPointerException at org.springframework.core.GenericTypeResolver.getTypeVariableMap</code>

No <span class="n"> or <span class="s2"> or ... and the code is not highlighted

Am I doing something wrong?

Source: (StackOverflow)

Local post assets with Jekyll

I was wondering how other people are organising their assets for individual posts when using Jekyll. For example, if a post has an image, do you just dump it in a shared images folder? I don't really like the idea of doing this - it means that an image is completely separated from a post, when I think they should be paired.

Source: (StackOverflow)

Jekyll auto reloading

Working with Jekyll for the first time, and it looks like the auto reload functionality (running jekyll --auto --server) is only triggered by updates to markdown files.

Is this the normal behavior? And is there any way to get changes to other types of files like css (I'm using scss) or html files in _layouts to trigger an auto-reload as well?

Source: (StackOverflow)

Generating a list of pages (not posts) in a given category

I am using Jekyll as a static generator for a website (not a blog), and I want to have an automatically generated list of all pages on my index page. Specifically, I want to have different categories and list all articles in each category separately. Here's an example of what I'm describing, if you're having trouble following. Is there any way to do this in Jekyll? I've seen the variables documentation page but that seems specific to the blog post format.

Source: (StackOverflow)

In Jekyll, is there a concise way to render a Markdown partial?

I've got a Markdown-formatted sidebar that I'd like to show up in my Jekyll blog. I'd previously tried to include it like {% include sidebar.markdown %} but it wouldn't actually render the Markdown. I can successfully include it like:

{% capture sidebar %}{% include sidebar.markdown %}{% endcapture %}
{{ sidebar | markdownify }}

and although this is a manageable solution, I'd prefer a more elegant way of accomplishing this. Any ideas? Thanks in advance!

Source: (StackOverflow)

jekyll markdown internal links

Jekyll uses Markdown-formatted links, but how can I link to internal content?


Source: (StackOverflow)

TCPServer Error: Address already in use - bind(2)

Jekyll was working fine for me few weeks back but now all of a sudden it gives me the following error:

TCPServer Error: Address already in use - bind(2)
INFO  WEBrick::HTTPServer#start: pid=7300 port=4000

 % lsof -i :4000
 <fetches nothing>

Even though nothing is running on the port. Below are the details:

 % jekyll --version
Jekyll 0.11.2
 % where jekyll
 % ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
 % rvm --version
rvm 1.10.0 

Here is the output

 % jekyll --server
Configuration from /home/bhaarat/blog/
Auto-regenerating enabled: /home/bhaarat/blog/ -> /home/bhaarat/blog/
[2012-04-21 13:46:40] regeneration: 38 files changed
[2012-04-21 13:46:40] INFO  WEBrick 1.3.1
[2012-04-21 13:46:40] INFO  ruby 1.9.2 (2011-07-09) [i686-linux]
[2012-04-21 13:46:40] WARN  TCPServer Error: Address already in use - bind(2)
[2012-04-21 13:46:40] INFO  WEBrick::HTTPServer#start: pid=7382 port=4000

I know the address isn't in use and jekyll is probably breaking for some other reason but throwing that error. What are my options? I've tried re-installing as well.

Source: (StackOverflow)

how to include video in jekyll markdown blog

I just started blogging using jekyll. I write my posts in markdown. Now, I want to include a youtube video in my post. How can I do this?

Also, I dont really like the pygments highlighting provided by jekyll by default. Is there anyway I can change this to some other style? If yes, can you point me to some nice styles/plugins?

Source: (StackOverflow)

How to customize Jekyll's url?

I would like to use Jekyll to create a site. not a blog. Is there a way to avoid to have the creation date specified in the url and in the page's file name?

I think that the idea behind Jekyll is brilliant, but it seems too tied to blog generation content while it could be useful also in a more general use case.

Source: (StackOverflow)

Get today's date in Jekyll with Liquid markup

This (should) be easy, I think, but I'm unable to get today's date to show in a Jekyll page using Liquid markup. According to the documentation, I should be able to do this to get this date's year:

{{ 'now' | date: "%Y" }}

But all that gets rendered is the string now, not any formatted date. What am I doing wrong?

Source: (StackOverflow)

How to show a preview of a post? (Using Jekyll Bootstrap theme)

This is probably an easy question, but how do I show previews of my posts on the default page? I am using the Jekyll Bootstrap theme Tom.

Source: (StackOverflow)