Skip to content

Commit

Permalink
fix: disqus not being async
Browse files Browse the repository at this point in the history
  • Loading branch information
GonzaloHirsch committed Jun 23, 2024
1 parent 7cece97 commit 7392e76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pages/blog/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ onMounted(() => {
// Add the script
const script = document.createElement('script');
script.id = targetId;
script.innerHTML = `var disqus_config = function () {this.page.url = "${canonicalPath}";this.page.identifier = "${data.value.article.dqid}";this.page.title = "${data.value.article.headline}"};(function () {var d = document,s = d.createElement('script');s.addEventListener("load", function() {loaded=true;});s.src = "https://gonzalohirsch.disqus.com/embed.js";s.setAttribute('data-timestamp', new Date());(d.head || d.body).appendChild(s);})(); /* * * Disqus Reset Function * * */var reset = function (newIdentifier, newUrl, newTitle, newLanguage) {DISQUS.reset({reload: true,config: function () {this.page.identifier = newIdentifier;this.page.url = newUrl;this.page.title = newTitle;this.language = newLanguage;}});};`;
script.innerHTML = `var disqus_config = function () {this.page.url = "${canonicalPath}";this.page.identifier = "${data.value.article.dqid}";this.page.title = "${data.value.article.headline}"};(function () {var d = document,s = d.createElement('script');s.addEventListener("load", function() {loaded=true;});s.async=true;s.src = "https://gonzalohirsch.disqus.com/embed.js";s.setAttribute('data-timestamp', new Date());(d.head || d.body).appendChild(s);})(); /* * * Disqus Reset Function * * */var reset = function (newIdentifier, newUrl, newTitle, newLanguage) {DISQUS.reset({reload: true,config: function () {this.page.identifier = newIdentifier;this.page.url = newUrl;this.page.title = newTitle;this.language = newLanguage;}});};`;
document.body.appendChild(script);
} else {
window.reset(
Expand Down

0 comments on commit 7392e76

Please sign in to comment.