gpt4 book ai didi

javascript - Disqus 未在 Jekyll 博客中加载

转载 作者:行者123 更新时间:2023-11-28 03:13:41 25 4
gpt4 key购买 nike

我无法让 Disqus 为我的 Jekyll 博客工作。我按照 Disqus 网站上的说明进行操作。我在帖子布局中添加了评论

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

{{ content }}

{% include disqus.html %}

使用 Disqus 网站生成的代码与 disqus.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 %}

这是我的网站 post 上的博客文章示例。 Here是我的 git hub 存储库(如果需要)。

最佳答案

看起来 page.urlpage.url 应该是字符串,但它们没有用引号引起来。这是在您的页面上呈现的配置:

var disqus_config = function () {
this.page.url = /blog/2020/01/15/rohit-gupta-blog-launched;
this.page.identifier = /blog/2020/01/15/rohit-gupta-blog-launched;
};

这可能就是您想要的:

var disqus_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-blog-launched';
};

完整更新的 disqus.html

<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 = 'https://rohitkumargupta.com{{ 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>

关于javascript - Disqus 未在 Jekyll 博客中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59843935/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com