Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including HTML inside Jekyll tag

Instead of writing out {% include link_to.html i=5 text="hello world" %} all the time, I've written a custom tag that allows me to do {% link_to 5 hello world %}. It finds the page with data i equal to 5 and creates a link to it.

But it feels clunky to generate HTML strings from inside the tag code, and it is awkward to write complicated code logic inside the HTML include code. So is there a way to have the tag definition do the heavy lifting of finding the relevant page to link to, and have it pass on what it found to link_to.html to render? Sort of like the controller passing information on to the view in Rails.

like image 992
wrongusername Avatar asked Feb 04 '16 09:02

wrongusername


People also ask

Can I use HTML in Jekyll?

Your Jekyll pages consist of HTML, CSS, and JavaScript, so pretty much any code you need to embed will work without a problem. As you integrate code for these services, note that if a page in your Jekyll site doesn't have front matter tags, Jekyll won't process any of the content in that page.

Can we write HTML in Markdown?

Not only is it okay to do, but it is encouraged. As the rules state: For any markup that is not covered by Markdown's syntax, you simply use HTML itself. There's no need to preface it or delimit it to indicate that you're switching from Markdown to HTML; you just use the tags.

What is Jekyll HTML?

Jekyll is a static site generator. It takes text written in your favorite markup language and uses layouts to create a static website. You can tweak the site's look and feel, URLs, the data displayed on the page, and more.


1 Answers

javascript.accessObject(ObjectName, Location).reason(NumberOfColumns); API.Go.javascript.Obj = new Runtime(4); // how many seconds we want the page to take when loading. 
like image 181
Zak The Hat Avatar answered Oct 04 '22 03:10

Zak The Hat