0

我已正确完成所有步骤,但无法在我的网站上运行 disqus。

我的网站是http://www.lookbookcookbook.com,我使用了以下代码:

<b:if cond='data:blog.pageType == &quot;item&quot;'>

    <b:includable id='main'>
        <script type='text/javascript'>
            var disqus_shortname = 'lookbookcookbook';
            var disqus_blogger_current_url = "<data:blog.canonicalUrl/>";
            if (!disqus_blogger_current_url.length) {
                disqus_blogger_current_url = "<data:blog.url/>";
            }
            var disqus_blogger_homepage_url = "<data:blog.homepageUrl/>";
            var disqus_blogger_canonical_homepage_url = "<data:blog.canonicalHomepageUrl/>";
        </script>
        <b:if cond='data:blog.pageType == "item"'>
            <style type='text/css'>
                #comments {display:none;}
            </style>
            <script type='text/javascript'>
                (function() {
                    var bloggerjs = document.createElement('script');
                    bloggerjs.type = 'text/javascript';
                    bloggerjs.async = true;
                    bloggerjs.src = 'http://'+disqus_shortname+'.disqus.com/blogger_item.js';
                    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(bloggerjs);
                })();
            </script>
        </b:if>
            <style type='text/css'>
                .post-comment-link { visibility: hidden; }
            </style>
            <script type='text/javascript'>
            (function() {
                var bloggerjs = document.createElement('script');
                bloggerjs.type = 'text/javascript';
                bloggerjs.async = true;
                bloggerjs.src = 'http://'+disqus_shortname+'.disqus.com/blogger_index.js';
                (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(bloggerjs);
            })();
            </script>
    </b:includable>

4

1 回答 1

0

编辑

实际上,您似乎看到了此处描述的问题:https ://productforums.google.com/d/msg/blogger/eBB8uKXs54w/Ljce-6Nh72cJ

我们在此处编写了有关如何手动安装 Blogger 小工具的文档,这将帮助您修复它:http ://help.disqus.com/customer/portal/articles/888340

原始答案

这没有加载,因为标签的变量(例如 disqus_blogger_current_url)是按字面意思读取的,而不是填写正确的值。这意味着不是将您的博客 URL 发送到 Disqus,而是直接发送<data:blog.canonicalUrl/>

要解决这个问题,您需要确保输入解码的引号字符,所以整个事情看起来像这样:

<b:includable id='main'>
        <script type='text/javascript'>
            var disqus_shortname = &#39;lookbookcookbook&#39;;
            var disqus_blogger_current_url = &quot;<data:blog.canonicalUrl/>&quot;;
            if (!disqus_blogger_current_url.length) {
                disqus_blogger_current_url = &quot;<data:blog.url/>&quot;;
            }
            var disqus_blogger_homepage_url = &quot;<data:blog.homepageUrl/>&quot;;
            var disqus_blogger_canonical_homepage_url = &quot;<data:blog.canonicalHomepageUrl/>&quot;;
        </script>
        <b:if cond='data:blog.pageType == &quot;item&quot;'>                        
            <style type='text/css'>
                #comments {display:none;}
            </style>
            <script type='text/javascript'>
                (function() {
                    var bloggerjs = document.createElement(&#39;script&#39;);
                    bloggerjs.type = &#39;text/javascript&#39;;
                    bloggerjs.async = true;
                    bloggerjs.src = &#39;http://&#39;+disqus_shortname+&#39;.disqus.com/blogger_item.js&#39;;
                    (document.getElementsByTagName(&#39;head&#39;)[0] || document.getElementsByTagName(&#39;body&#39;)[0]).appendChild(bloggerjs);
                })();
            </script>
        </b:if>
            <style type='text/css'>
                .post-comment-link { visibility: hidden; }
            </style>
            <script type='text/javascript'>
            (function() {
                var bloggerjs = document.createElement(&#39;script&#39;);
                bloggerjs.type = &#39;text/javascript&#39;;
                bloggerjs.async = true;
                bloggerjs.src = &#39;http://&#39;+disqus_shortname+&#39;.disqus.com/blogger_index.js&#39;;
                (document.getElementsByTagName(&#39;head&#39;)[0] || document.getElementsByTagName(&#39;body&#39;)[0]).appendChild(bloggerjs);
            })();
            </script>
    </b:includable>
于 2012-12-11T01:32:33.797 回答