I use HUGO to generate static webpages. In the disqus code, I set the page identifier to the page URL. Now, if my website structure is something like /post/website.md, then everything works as expected. However, I wanted to group my posts by year, so I created the structure /post/year/website.md. This results in disqus using the same thread for all posts from the given year, not what I intended. If I change the structure to /post/_year/website.md, everything works again as expected, one thread per post.
It seems that Disqus ignores the identifier I set if it recognizes a year like 2023 in the URL. I cannot find the documentation for this anywhere on disqus.
Here is the code I used to insert the Disqus post ids in hugo:
<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 = '{{ .Permalink }}'; // Replace PAGE_URL with your page's canonical URL variable
this.page.title = '{{ .Title }}';
this.page.identifier = '{{ .RelPermalink }}'; // 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://xxxxxxx.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
As this.page.identifier I tried various things, including .Permalink and combining it with other strings.