Create a gist now

Instantly share code, notes, and snippets.

@benbalter /gist.md
Last active Oct 16, 2017

What would you like to do?
Example of how to embed a Gist on GitHub Pages using Jekyll.

Here's an example of how to embed a Gist on GitHub Pages:

{% gist 5555251 %}

All you need to do is copy and paste the Gist's ID from the URL (here 5555251), and add it to a gist tag surrounded by {% and %}.

And here's what it would look like rendered:

Rendered Gist

lowellk commented May 14, 2013

The rendered output looks odd for the gist link

I wonder if being meta makes this harder to understand.

zeke commented May 19, 2013

gistception

slice commented May 22, 2013

Wow, this addition looks useful.

Is there a way to embed a single file? Yes there is!

{% gist 5555251 gist.md %}

kidlj commented Sep 14, 2013

Nice tip. forked.

LeahCim commented Mar 30, 2014

Cool, thanks!

abhiesa commented Aug 5, 2014

No solution, till end, what is cool, i don't understand.
Just contacted Github, and put this as a feature request.
Hope, that anybody sees this, will also do the same.

h4ckm03d commented Aug 7, 2014

very useful, thanks. 👯

is this feature still working guys? i couldn't get it to work!!

iplus26 commented Sep 26, 2015

Yes, it works and it's pretty!

What about for non-gists?

hndr91 commented Sep 21, 2016

I've tried and it doesn't work. I just paste gist embed code on page and it work

alejobit commented Oct 28, 2016 edited

It works by installing https://github.com/jekyll/jekyll-gist

But I prefer to use:

<script src="https://gist.github.com/benbalter/5555251.js"></script>
<script src="https://gist.github.com/benbalter/5555251.js?file=gist.md"></script>

ogurcan commented Mar 8, 2017

I tried to embed <script src="https://gist.github.com/benbalter/5555251.js"></script> and other examples in an .md file, however it doesnt work :(

abelvi59 commented Sep 4, 2017

thanks for this example brother
GeneroNovelas Románticas

palevell commented Oct 9, 2017

This didn't work for me . . .
Error: Liquid syntax error (line 3): Unknown tag 'gist'

But, using the Embed code from the gist page worked, just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment