Re-use Disqus configuration

This commit is contained in:
squidfunk 2021-10-02 13:51:54 +02:00
parent e71b129433
commit eaa6e91884
2 changed files with 2 additions and 5 deletions

View File

@ -8,5 +8,5 @@
{% if not page.is_homepage and disqus %} {% if not page.is_homepage and disqus %}
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2> <h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
<div id="disqus_thread"></div> <div id="disqus_thread"></div>
<script>var script,disqus_config=function(){this.page.url="{{ page.canonical_url }}",this.page.identifier="{{ page.canonical_url | replace(config.site_url, '') }}"};"undefined"==typeof DISQUS?((script=document.createElement("script")).async=!0,script.src="https://{{ disqus }}.disqus.com/embed.js",script.setAttribute("data-timestamp",Date.now()),document.body.appendChild(script)):DISQUS.reset({reload:!0,config:function(){this.page.identifier="{{ page.title }}",this.page.url="{{ page.canonical_url }}"}})</script> <script>var script,disqus_config=function(){this.page.url="{{ page.canonical_url }}",this.page.identifier="{{ page.canonical_url | replace(config.site_url, '') }}"};"undefined"==typeof DISQUS?((script=document.createElement("script")).async=!0,script.src="https://{{ disqus }}.disqus.com/embed.js",script.setAttribute("data-timestamp",Date.now()),document.body.appendChild(script)):DISQUS.reset({reload:!0,config:disqus_config})</script>
{% endif %} {% endif %}

View File

@ -51,10 +51,7 @@
} else { } else {
DISQUS.reset({ DISQUS.reset({
reload: true, reload: true,
config: function () { config: disqus_config
this.page.identifier = "{{ page.title }}"
this.page.url = "{{ page.canonical_url }}"
}
}) })
} }
</script> </script>