Issues adding github gist to my blog(using Google blogger)

后端 未结 7 860
故里飘歌
故里飘歌 2021-02-09 17:26

I\'m trying to add a gist to my blog to see how it works and use it to share some code related blogs going forward.

I\'ve followed the steps mentioned form this blog, bu

相关标签:
7条回答
  • 2021-02-09 17:47

    The 3rd party github hosted file tag didn't work for me at all. - <script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"></script>

    failed in chrome with Refused to execute script from 'https://raw.github.com/moski/gist-Blogger/master/public/gis‌​tLoader.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

    The embed links on github's site work, but for those wanting to avoid the reliance on a script link, I wrote code to pull down what the embed link serves up and decode it for pasting into blogger. LinqPad code at https://github.com/ImaginaryDevelopment/LinqPad/blob/master/LINQPad%20Queries/LanguageTranslators/fetch%20then%20parse%20gist%20html.linq

    0 讨论(0)
  • 2021-02-09 17:54

    The blog post you mention explains everything clearly and it's all you have to do. I'll describe what I did:

    1. I copied the <script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"></script> into a widget that is dynamically loaded into each blog page (posts, pages, everything). This will not work, because, as being said, include the following code at the end of each of your blog posts. This means you have to include it separately in al your posts. Yes, I don't like it as well, but the blog entries are loaded dynamically, so you have to load gists after the original blog entry is loaded.

    2. Put the <div class="gistLoad" data-id="GistID" id="gist-GistID">Loading ....</div> just where you would put original github gist code. For example - this is a gist I wanted to display on my post. This is the original code: <script src="https://gist.github.com/tkoomzaaskz/6235219.js"></script>. The gistID is 6235219. So, instead, I put <div class="gistLoad" data-id="6235219" id="gist-6235219">Loading ....</div>. And in the end of the post, I put the javascript source from point 1.

    This blog post is an example that it works fine.

    0 讨论(0)
  • 2021-02-09 17:56

    I dont know, whether your are trying gist content made it as private or public. Here are the few steps for how to implement PUBLIC gist code into your blogger.

    1) Create a gist file in gist.github.com(While you save the file just choose as "Create Public Gist"

    2) Take/copy the code "Embed URL" text box(almost you done).

    3) Login to your blogger and add copied code into your desired posts. Thats all. Your public gist code will display in your page.

    Actual article from here

    0 讨论(0)
  • 2021-02-09 17:59

    For me it was because i was using dynamic view template on google blogger. When i changed it to simple then the javascript was working and showed the gist.

    0 讨论(0)
  • 2021-02-09 18:01

    Kindly look for the Embed code ofrthe gist, i found out it to be

    <script src="https://gist.github.com/boddhisattva/4132084.js"></script>
    

    The just create a blogpost in blogger.com with just the above script, it's that easy

    0 讨论(0)
  • 2021-02-09 18:03

    A simpler solution (since October 2014): www.gistfy.com:

    Gistfy is an easy way to create embeddable code snippets from your GitHub and Bitbucket repositories or your GitHub Gist.

    For example:

    <script type='text/javascript' src='http://www.gistfy.com/github/gist/10666727'></script>
                                                                             ^
                                                                      (id of a GitHub Gist)
    
    0 讨论(0)
提交回复
热议问题