Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check before loading comments #374

Merged
merged 1 commit into from
Mar 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions layouts/partials/third-party/disqus.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{{- $rawTitle := (partial "utils/title.html" (dict "$" . "title" .Title)).rawTitle -}}
<script>
function loadComments() {
if (!document.getElementById('disqus_thread')) {
return;
}
if (typeof DISQUS === 'undefined') {
var disqus_config = function() {
{{ with .Params.disqus_url | default .Permalink }}this.page.url = '{{ . }}';{{ end }}
Expand Down
5 changes: 4 additions & 1 deletion layouts/partials/third-party/gitalk.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
<script>
function loadComments() {
if (!document.getElementById('gitalk-container')) {
return;
}
if (typeof Gitalk === 'undefined') {
var getScript = (options) => {
var script = document.createElement('script');
Expand Down Expand Up @@ -41,4 +44,4 @@

gitalk.render('gitalk-container')
}
</script>
</script>
3 changes: 3 additions & 0 deletions layouts/partials/third-party/utterances.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
function loadComments() {
(function() {
var utterances = document.getElementById("utterances");
if (!utterances) {
return;
}
var script = document.createElement('script');
script.src = 'https://utteranc.es/client.js';
script.async = true;
Expand Down
3 changes: 3 additions & 0 deletions layouts/partials/third-party/valine.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<script>
function loadComments() {
if (!document.getElementById('vcomments')) {
return;
}
if (typeof Valine === 'undefined') {
var getScript = (options) => {
var script = document.createElement('script');
Expand Down