Making disqus installation more robust #569
Open
+7
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello
With this PR I'm trying to make Disqus work independently if of your domain URL, in case you don't know it or have to change it.
I had some problems getting Disqus to work on my new site. After some trial error, I found that the problem was that
this.page.url
was not an absolute_url as Disqus needs (https://help.disqus.com/en/articles/1717084-javascript-configuration-variables).Adding
url:<you prod base URL>
to the Jekyll configuration (_config.yml
) solved the problem without changing the code, but, as for me, some people might want not to set it.Also, in the Disqus documentation, they recommend using a
this.page.identifier
that doesn't change if the domain change, to retain the comments in that case. I changed that to be the relative URL (page.url
). I was tempted to usepage.id
but non-post pages don't have one and thepage.id
ispage.url
without the file extensionThere is an open PR #536 that could be closed with this one and that shows figuring out the Disqus error is not trivial for normal users.
I'm neither a JS nor Jekyll expert. Any comment or ideas making this code better are welcome! 😃