Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix discourse urls #1181

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _includes/comments-providers/discourse.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if site.comments.discourse.server %}
{% capture canonical %}{% if site.permalink contains '.html' %}{{ page.url | absolute_url }}{% else %}{{ page.url | absolute_url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %}
{% capture canonical %}{{ page.url | replace: 'index.html','' | prepend: site.baseurl | prepend: site.url }}{% endcapture %}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of prepending baseurl and url use the absolute_url filter which does both of these operations.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I misconfigured something, but I am pretty sure the canonical resulted in a relative url, and that's why I got here. Go figure.
So would this be the simpler solution?:

{{ page.url | replace: 'index.html','' | absoulte_url }}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but that's pretty much what it is now... except your version removes a few more checks.

I guess I'm waiting for someone else to verify this is actually broken and not outputting the expected URL for Discourse and not some sort of Jekyll/environment/configuration issue.

<script type="text/javascript">
DiscourseEmbed = { discourseUrl: '//{{ site.comments.discourse.server }}/',
DiscourseEmbed = { discourseUrl: '{{ site.comments.discourse.server }}/',
discourseEmbedUrl: '{{ canonical }}' };
(function () {
var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
Expand Down