Skip to content

Instantly share code, notes, and snippets.

@skopp
Last active December 7, 2020 03:18
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save skopp/5214191 to your computer and use it in GitHub Desktop.
Save skopp/5214191 to your computer and use it in GitHub Desktop.
A simple way to embed gist into Blogger's dynamic view.
<!-- to do: make this parse -->
<div class="clipboardEmbedClip" data-clip-id="LQL1lDhsxPcZfc2h4vuk3E1MpI-5Xc_CPlqe" data-width="782" data-height="763" data-scale="disabled">
</div>
<script type="text/javascript">(function() {if (!window.CLIPBOARD || !window.CLIPBOARD.widgets) {var elem = document.createElement("script");elem.type = "text/javascript";elem.async = true;elem.src = "//clipboard.com/js/widgets.js";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(elem, s);}})();
</script>
A simple way to embed gist into Blogger's dynamic view. By [Moski Doski](http://moski.me).

__

Usage

At the end of each of your blog posts, include the following code using the HTML editor:

<script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"></script>

Now to include any gist template just add the following anywhere in your blog post.

<div class="gistLoad" data-id="GistID" id="gist-GistID">Loading ....</div>

Replace "GistID" with your gist id.

Development

If you want to work with this script locally. You need to clone the repo using

git clone git@github.com:moski/gist-Blogger.git

To start up the server, just run

rackup

Now, to use the local version of the script, change the script embed code in your post to the local version

<script src="http://localhost:9292/gistLoader.js" type="text/javascript"></script>

You also need to change the main script path inside (gistLoader.js)

//var gistBloggerPath = "https://raw.github.com/moski/gist-Blogger/master/public/gistBlogger.js";
var gistBloggerPath = "http://localhost:9292/gistBlogger.js";

That's it, now blogger will start calling your script.

Thanks

@mcmoe
Copy link

mcmoe commented Aug 25, 2017

@ImaginaryDevelopment Use rawgit.com instead of raw.github.com - read this for more details https://github.com/blog/1482.

[GitHub] added the X-Content-Type-Options: nosniff header to [their] raw URL responses [to] combating hotlinking.

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