smallseo.info

jekyll

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:

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

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 0.0.0.0, 127.0.0.1 and localhost?

I am using Jekyll and Vagrant on my mac. I found that Jekyll server will bind to 0.0.0.0:4000 instead of 127.0.0.1:4000. 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. 0.0.0.0:4000) 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 (0.0.0.0:4000), it works. I can visit it from my safari with http://localhost:8080. But if there is not internet, I cannot bind to 0.0.0.0:4000. I use jekyll server -H 127.0.0.1 to bind service to 127.0.0.1:4000 instead, then I cannot visit it via http://localhost:8080.

Can anyone explain the difference between 0.0.0.0, 127.0.0.1 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>
</ul>       

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
  7 
  8 source:      .
  9 destination: ./_site
 10 plugins:     ./_plugins
 11 
 12 future:      true
 13 lsi:         false
 14 pygments:    false
 15 markdown:    maruku
 16 permalink:   date
 17 
 18 maruku:
 19   use_tex:    false
 20   use_divs:   false
 21   png_engine: blahtex
 22   png_dir:    images/latex
 23   png_url:    /images/latex
 24 
 25 rdiscount:
 26   extensions: []
 27 
 28 kramdown:
 29   auto_ids: true,
 30   footnote_nr: 1
 31   entity_output: as_char
 32   toc_levels: 1..6 
 33   use_coderay: false
 34 
 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:

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

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)

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 {{ page.date| 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)

Jekyll on Windows: Pygments not working

I updated to the latest JekyllBuild (1.0.3) before I always used the RC. After updating the parsing of codes (with Pygments) doesn't work anymore. I always get the following error:

C:/Ruby193/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:162: warning: cannot close fd before spawn
←[31m  Liquid Exception: No such file or directory - /bin/sh in 2012-01-17-test-post.md←[0m

Did anyone also ran into this problem?

I have no clue about ruby, so I can not debug this myself :(


Source: (StackOverflow)