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

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)

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)

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)

Using MathJax with Jekyll

I have a Jekyll blog and I want to use MathJax with it, in the sense that I want to be able to type something like

$$\sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6}$$

in my markdown files, and have the correct LaTeX expression generated with MathJax, in a similar way to how it is done at math.stackexchange.

What is the easiest way to do this? Currently I have the file jsmath.js (GitHub gist) in my directory, and I thought I could have a simple file named mathjs in my _includes directory with the line

<script src="path/to/jsmath.js></script>

and include that in each post via

{% include mathjs %}

but this doesn't seem to work - when I run jekyll --server the page is generated, but none of the content is visible.

Am I going about this the right way? Is there a better way to use MathJax with Jekyll?

Source: (StackOverflow)

How do I chain if statements in Jekyll?

I am using a logic operator in Jekyll but it's not working.

Page one, two and three all use the same layout (part of a multilingual solution, works good but requires logical loops for some layout control to keep things DRY.)

Here's the code:

{% if page.type == "post" %}
{% include post.html %}
{% elseif page.class == "contact" %}
{% include contact.html %}
{% else %}
{{ content }}
{% endif %}

If I break it down to just an else and an if else setup, with any two of the tree, everything works. But as soon as I use a third condition it breaks. Am I limited to two conditionals with Jekyll? I can potentially restructure to make a case operator applicable, but I'd prefer to understand the fundamental problem here. Thanks all.

Source: (StackOverflow)

Error Installing Jekyll - Native Extension Build

I'm having some trouble installing jekyll. Can't quite figure out how to patch the missing link. I think it's an update to Ruby, but RVM is having trouble installing alternate versions of ruby as well.

Heres the full post:

$ sudo gem install jekyll    

ERROR:  Error installing jekyll:
ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/fast-stemmer-1.0.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/fast-stemmer-1.0.1/ext/gem_make.out

Does this mean I need to update the version of ruby I'm using via rvm?

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)

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)

Github - Jekyll - Old pages redirection - best approach

I have blog on github pages - jekyll

What is the best way to solve url strategy migration?

I found the best practice in common is create htaccess like so

Redirect 301 /programovani/2010/04/git-co-to-je-a-co-s-tim/ /2010/04/05/git-co-to-je-a-co-s-tim.html

But it does not seems to work with Github. Another solution i found is create rake task, which will generate redirection pages. But since it's an html, it's not able to send 301 head, so SE crawlers will not recognize it as an redirection.

Source: (StackOverflow)

Table not render when use Redcarpet in Jekyll GitHub Pages?

As of maruku engine (the default), writing table like

surround text, etc.

| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |

surround text...

would render correctly.

But when I switch to redcarpet (add markdown: redcarpet into _config.yml), the table no longer rendered, both localhost and on GitHub Pages.

Did I do something wrong?

Source: (StackOverflow)

Upload images to GitHub from the browser

I am using GitHub Pages, Jekyll, and Prose to manage a Website. Everything works fine, besides I cannot find a way to upload images. The Prose image uploader is not working probably as discussed in various tickets (for instance here).

Since the Website is for a friend without any git or command line experience, I am looking for another option to upload images easily from the browser to GitHub. Are there any other options like this? I don't want to host the image on an external site.

Source: (StackOverflow)

How does Jekyll date formatting work?

I'm using Jekyll to generate a simple site.

I want the date field to display in the format 12 September 2011.

I've found, through some creative googling, a bit of date-format manipulation, but nothing that seems to get me the month name. What I have is {{| date: "%m-%d-%Y" }}, which gets me output as 09-12-2011, but isn't quite what I'm looking for.

Is there any way to get the month as a name in Jekyll?

Or, barring that, is there any documentation for the date attribute?

Source: (StackOverflow)

Jekyll Bootstrap based blog - Expire headers?

I have a Jekyll bootstrap based blog hosted on Github pages.

My problem is: Every time I change something on my web page, I have to forcefully reload the page (CTRL + R) to see the changes.

Jekyll or my browser does not seem to realize that there is a newer version available to send out.

How can I configure Jekyll to better handle this?

Source: (StackOverflow)

An easy way to support tags in a jekyll blog

I am using the standard jekyll installation to maintain a blog, everything is going fine. Except I would really like to tag my posts.

I can tag a post using the YAML front matter, but how do I generate pages for each tag that can will list all posts for a tag?

Source: (StackOverflow)

Using Live Reload with Jekyll

I'm getting started with Jekyll static site generator and I would like to use Live Reload with it. I know Jekyll has a generator and server commands, and Live Reload can run various compilers and custom commands. How do I configure these to work together?

Source: (StackOverflow)