Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/469.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未在Jekyll博客中加载Disqs_Javascript_Html_Jekyll_Disqus - Fatal编程技术网

Javascript 未在Jekyll博客中加载Disqs

Javascript 未在Jekyll博客中加载Disqs,javascript,html,jekyll,disqus,Javascript,Html,Jekyll,Disqus,我无法为我的杰基尔博客工作。我遵循了论文网站上的说明。 我在帖子布局中添加了评论 --- layout: default comments: true --- <h1>{{ page.title }}</h1> <p>{{ page.date | date_to_string }} - {{ page.author }}</p> {{ content }} {% include disqus.html %} --- 布局:默认值 评论:是的

我无法为我的杰基尔博客工作。我遵循了论文网站上的说明。 我在帖子布局中添加了评论

---
layout: default
comments: true
---
<h1>{{ page.title }}</h1>
<p>{{ page.date | date_to_string }} - {{ page.author }}</p>

{{ content }}

{% include disqus.html %}

---
布局:默认值
评论:是的
---
{{page.title}}
{{page.date}date_to_string}-{{page.author}

{{content}} {%include discs.html%}
使用由Disqs网站生成的代码使用disqs.html

{% if page.comments %}
<div id="disqus_thread"></div>
<script>

/**
*  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
*  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/

var disqus_config = function () {
this.page.url = {{ page.url }};  // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = {{ page.id }}; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};

(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://rohit-gupta-blog.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

{% endif %}

{%if page.comments%}
/**
*建议的配置变量:编辑并取消注释下面的部分,以插入来自平台或CMS的动态值。
*了解定义这些变量的重要性:https://disqus.com/admin/universalcode/#configuration-变数*/
var discus_config=函数(){
this.page.url={{page.url}};//用页面的规范url变量替换页面url
this.page.identifier={{page.id};//用页面的唯一标识符变量替换页面标识符
};
(函数(){//不要在此行下方编辑
var d=document,s=d.createElement('script');
s、 src='1〕https://rohit-gupta-blog.disqus.com/embed.js';
s、 setAttribute('data-timestamp',+new Date());
(d.头| | | d.身体)附肢儿童;
})();
请启用JavaScript以查看
{%endif%}

下面是我网站上的一篇博客文章的例子。是我的git hub存储库(如果需要)。

它看起来像
页面。url
页面。url
应该是字符串,但不在引号中。以下是页面上呈现的配置:

var discus\u config=function(){
this.page.url=/blog/2020/01/15/rohit gupta博客发布;
this.page.identifier=/blog/2020/01/15/rohit gupta博客发布;
};
这可能是您想要的:

var discus\u config=function(){
this.page.url=https://rohitkumargupta.com/blog/2020/01/15/rohit-gupta-blog-launched';
this.page.identifier='/blog/2020/01/15/rohit gupta博客发布';
};
完整更新的discus.html


/**
*建议的配置变量:编辑并取消注释下面的部分,以插入来自平台或CMS的动态值。
*了解定义这些变量的重要性:https://disqus.com/admin/universalcode/#configuration-变数*/
var discus_config=函数(){
this.page.url=https://rohitkumargupta.com{{page.url}}};//用页面的规范url变量替换page_url
this.page.identifier='{{page.id}}';//用页面的唯一标识符变量替换页面标识符
};
(函数(){//不要在此行下方编辑
var d=document,s=d.createElement('script');
s、 src='1〕https://rohit-gupta-blog.disqus.com/embed.js';
s、 setAttribute('data-timestamp',+new Date());
(d.头| | | d.身体)附肢儿童;
})();
请启用JavaScript以查看

可能是
{%if page.comments%}
条件不起作用(不正确)。尝试临时删除
{%if page.comments%}
和关联的
{%endif%}
以进行验证。仍不工作。不过我现在可以在页面源代码中看到脚本了。谢谢你的帮助。您的解决方案“有效”,但我收到一条消息“我们无法加载取消论文”。嘿@RohitKumarGupta。我相信Discus希望
page.url
属性是您文章的完整规范url。尝试将协议和域添加到字符串中。我已经更新了我的答案。