disqus_identifier with uppercase characters is changed to lowercase

Hi,

I’m migrating my old blog to Hugo (using 0.31.1 on Windows / Linux 64bits), all went well until I started to migrate disqus.

I have some page name (slug) that were containing uppercase characters. It was an error back when I created them but I must live with it :(.

One of this file has this front matter :

---
title: "COPS 1.0.0RC3"
date: 2014-12-30
tags: [calibre,ereader,nginx,opds,php]
slug: cops-1.0.0RC3
disqus_identifier: /blog/cops-1.0.0RC3
---

The slug is being lowercased … that’s not surprising and I have no problem with it. But my disqus_identifier is also lowercased, check the content of the embedded script in my generated html page :


    var disqus_config = function () {
    this.page.identifier = '\/blog\/cops-1.0.0rc3';
    
    
    };
    (function() {
        if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) {
            document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.';
            return;
        }
        var d = document, s = d.createElement('script'); s.async = true;
        s.src = '//' + "REDACTED" + '.disqus.com/embed.js';
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();

Is this a bug or is there a parameter somewhere ?

Disqus is case sensitive so that feel wrong.

Thanks in advance

You can convert it to uppercase with the upper function.

I don’t want to make it full upper case, I just want it to keep it exactly as it’s typed in the front matter. In my case the case is mixed :

disqus_identifier: /blog/cops-1.0.0RC3

In your config set

disablePathToLower = true

That should keep the slug as you typed it.

The thread starter asks about this value. Without seeing how it’s used in the templates, it is hard to determine how it gets lowercased.

1 Like

And that could be set as disqus_identifier:/blog/{{ .Slug }}

Sorry I should have made clear that I used the default disqus implementation :

Here is a snippet of my single.html :

            <div class="disqus">
                {{ template "_internal/disqus.html" . }}
            </div>

OK; I see it now … Hmm … the GetParam method lowercases the strings it returns … which may make sense for some internal usage but does not make sense as a general thing.

I will (eventually) fix this, but the current workaround would be to create your own disqus template.

@bep

Thanks a lot for creating this issue and sorry for omitting some important information, I’ll get better next time

It is necessary in all functions to disable the paranoid habit of changing the register of user data.

In this case I think it was an internal method that was accidentally exported; don’t try to make this issue about “everything else”.