-
Notifications
You must be signed in to change notification settings - Fork 25.6k
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
Fix discourse urls #1181
Conversation
My two cents:
|
Yes looking at the canonical url in xml feed makes sense. Where is that
constructed?
…On Aug 16, 2017 14:21, "Robert Riemann" ***@***.***> wrote:
My two cents:
- I use currently still a very old version of jekyll+this theme, i.e.
I have no experience here.
- I could imagine that the discourse canonical url must match the url
in the RSS feed that is read in by Discourse. So shouldn't we create the
canoncical url in the same manner like in feed.xml ?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1181 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABAmNHnyZf4jiIws3TpAIbm4DjbRF5qSks5sYt7ZgaJpZM4O4w2n>
.
|
@tendon That's handled not by the theme but by jekyll/jekyll-feed plugin. |
It seems that feed.xml uses simply
{{ post.url | absolute_url }}
…On Wednesday, 16 August 2017 15:10:58 CEST Michael Rose wrote:
@tendon That's handled not by the theme but by [jekyll/jekyll-feed
plugin](https://github.com/jekyll/jekyll-feed/blob/master/lib/jekyll-feed/f
eed.xml).
|
@@ -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 %} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 }}
There was a problem hiding this comment.
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.
Which is pretty much what we're using now, just with a few filters to deal with |
The current discourse embedding snippet was not working for me. I found two problems
the
discourseUrl
variable hardcoded a couple of forward slashes at the beginning. The correct path should be set only with thesite.comments.discourse.server
configuration variable.the canonical url assigned to
discourseEmbedUrl
was not computed correctly.This commit attempts to fix both.