Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jekyll - make a list of page.tags

Tags:

tags

jekyll

I'm new to jekyll and am working on building my site.

I have a "posts" layout where I'd like to have all the tags associated with the post appear in the left column. The problem I'm running into is that using {{ page.tags }} returns a list of tags that are not comma-separated and looks messy. See here for an example.

The html code for the layout page is:

<div class="span3">
    </br>
    <img src="{{ page.root }}assets/img/glyphicons_045_calendar.png" /> {{ page.date | > date: "%d %B %Y" }}    
    </br> 
    <img src="{{ page.root }}assets/img/glyphicons_066_tags.png" /> {{ page.tags }}
 </div>

<div class="span9">
    <h1> {{ page.title }} </h1>
    {{ content }}
</div>

Any advice on how to (a) get the tags list to be comma-separated and (b) wrap around so it stays within the left column? Thanks!

like image 401
JohnSG Avatar asked Apr 05 '13 20:04

JohnSG


1 Answers

You might try to put them inside a <p> tag so they can wrap around.

To have them comma-separated, you can follow the jekyll docs and use:

{{ page.tags | array_to_sentence_string }} => foo, bar, and baz

As is said in the Jekyll wiki.

like image 128
agarie Avatar answered Sep 28 '22 22:09

agarie