BY indefiniteloop


About some months ago, I wrote this post about adding the target attribute to your anchor tags in Jekyll with Markdown, and Liquid. Recently, I required to add more attributes than just the target attribute in a link using markdown with Jekyll, without having to resort to writing HTML.

On doing some research, and experimentation I found a way to add more than just the target attribute to a link using markdown, in Jekyll.

Please note: I have’t tested this with anything other than Kramdown

1 This is [a link](http://example.com){:target="_blank"} that opens in a new window.

The above markdown code shows you how to add the target attribute to links in Jekyll

Now, if you want to add more attributes to the link along with the target attribute with markdown + liquid in Jekyll, here’s how you do that.

1 This is [a link](http://example.com){:target="_blank" rel="nofollow" title="a link with more attributes" class="some-class"} that opens in a new window.

The above markdown shows you how to add more attributes to links in Jekyll

That’s it. With the above syntax you can add any number of attributes to links in Markdown (using Kramdown, with Jekyll). Note, that the : is just used once at the beginning of ruby’s hash like syntax.

Hope this helps someone!




About The Author:

Home Full Bio