I am trying to output the current page URL for Disqus comments. Since my page URL structure is like:
https://www.example.com/post/1234/2017-03-30/
I am having a little issue with escaping 2017-03-30.
I don't know if this has been asked before, I tried searching for reasonable answer but couldn't find any. I am trying to escape date, since including it like 2017-03-30 will only subtract it.
This is the PHP code that outputs Javascript:
echo 'this.page.url = "https://www.example.com/post/'. $id . '/\\'. $date . '\\/";';
Although the output would be:
this.page.url = "https://www.example.com/post/1234/\2017-03-30\/";
But the problem is Disqus will show the URL like:
https://www.example.com/post/1234/7-03-30
I know the problem is with \201 but what I don't know is how to fix it. I tried different ways. Nothing seems to be working. I am pretty much lost here. :/