问题描述
我正在尝试将添加到我的,看看它是如何工作的,并用它来分享一些与代码相关的博客。 / p>
我按照,但我无法让它工作。我不知道我错过了什么,关于我可能错过的任何指针都会非常感激。
我的博客相关代码的HTML编辑器如下所示: -
< div dir =ltrstyle =text-align:left; trbidi 上 > =;
< div dir =ltrstyle =text-align:left; trbidi 上 > =;
嗨< br />
< br />
测试< br />
< br />
< br />
< div class =gistLoaddata-id =4132084id =gist-4132084>
正在加载....< / div>
< br />
< br />
< br />
< br />
< / div>
< script src =https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.jstype =text / javascript>< / script> < / DIV>
谢谢。
UPDATE (包括更改上面的代码)
我发现有一件事困惑了一会儿,为什么我应该实际粘贴一个div标记在博客的撰写部分,它是最后的HTML代码,所以我将它移动到博客的HTML编辑器部分。最初让我感到困惑的是当它在博客中提到时: - $ /
但无论如何,现在,我只能得到加载..,错误仍然存在。 。
以下代码对我来说是正确的。我必须确保在div 内拷贝代码作为嵌入要点的一部分,当你真正看到自己的真实要点时(例如) Github 。
另外,我犯的另外一个错误是在我的代码中,JS并不完全在帖子之外(如果你仔细观察(我的坏),它实际上在最后一个div内)。无论如何,所有的结局都很好:)。所以这里是代码为我做了 -
< div dir =ltrstyle =text-align:剩下; trbidi 上 > =;
< div dir =ltrstyle =text-align:left; trbidi 上 > =;
嗨< br />
< br />
测试< br />
< br />
< br />
< div class =gistLoaddata-id =4132084id =gist-4132084>
< script src =https://gist.github.com/boddhisattva/4132084.js>< / script>
如果你想看看我能够在博客中嵌入主要内容,你可以在stackoverflow问题上看看
,我< a href =http:/ / /stackoverflow.com/questions/18788724/issues-adding-github-gist-to-my-blogusing-google-blogger/21355714#21355714\">此处发布< / a>同样,当我最初面临的问题得到这个为我工作。
向原始< a href =http://blog.moski.me/2012/01/gist-with-bloggers-dynamic-views.html>博客作者的帖子发布信息< a取代。
< / div>
< br />
< br />
< br />
< br />
< / div>
< / div>
< script src =https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.jstype =text / javascript>< / script>
以下是实际的链接,它使用上面的代码。
干杯..:)
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, but I'm not able to get it to work. I don't know what I'm missing, any pointers on what I could be missing would be really appreciated.
My HTML Editor of blog related code looks like this:-
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Hi<br />
<br />
test<br />
<br />
<br />
<div class="gistLoad" data-id="4132084" id="gist-4132084">
Loading ....</div>
<br />
<br />
<br />
<br />
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; word-wrap: break-word;"></pre>
</div>
<script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"></script> </div>
Thanks.
UPDATE (including, changing the code above)
I found one thing confusing for a while, why should I actually paste a div tag in the "Compose" Section of the Blog, it's afterall HTML code, so I moved it to the HTML editor part of the Blog. What was confusing to me initially was when it was mentioned in the blog:-
But anyways, now, I only get "Loading" .., The error still persists..
Here's the code that did it correctly for me. I had to ensure that within the div I copy the code that comes as part of 'Embed the gist' when you actually see one's real gist(say for e.g., this gist) on Github.
Also, one more mistake I made was in my code, the JS was not completely outside the post(it was actually inside the last div if you observer closely(my bad)). Anyways, All's well that end's well :). So here's the code that did the trick for me -
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Hi<br />
<br />
test<br />
<br />
<br />
<div class="gistLoad" data-id="4132084" id="gist-4132084">
<script src="https://gist.github.com/boddhisattva/4132084.js"></script>
In case you want to see how I was able to embed the gist in my blog, you can have a look
at the stackoverflow question that I <a href="http://stackoverflow.com/questions/18788724/issues-adding-github-gist-to-my-blogusing-google-blogger/21355714#21355714">posted here</a> on the same when I had initially faced issues to get this to work for me.
Credits to the original <a href="http://blog.moski.me/2012/01/gist-with-bloggers-dynamic-views.html">blogger's post</a>.
</div>
<br />
<br />
<br />
<br />
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; word-wrap: break-word;"></pre>
</div>
</div>
<script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"></script>
Here's the actual blog link which uses the above code.
Cheers.. :)
这篇关于在我的博客中添加github要点的问题(使用Google博客)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!