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

Relative URL breaks link on comment timestamp #1368

Closed
irgendwr opened this issue May 29, 2022 · 4 comments
Closed

Relative URL breaks link on comment timestamp #1368

irgendwr opened this issue May 29, 2022 · 4 comments
Assignees

Comments

@irgendwr
Copy link

irgendwr commented May 29, 2022

Hi,

in the frontend-config I set the url to window.location.pathname, so the URL is relative and does not contain the domain.
In the embedded comments widget the timestamps have an href that is set to url + #remark42__comment-<ID>, which leads to the link pointing to https://remark42.<domain>/<path>#remark42__comment-<ID> (with the remark subdomain => invalid URL) instead of https://<domain>/<path>#remark42__comment-<ID> (correct URL). The last-comments widget on the other hand supports relative URLs, as it does not use an iframe.

Version: v1.9.0-0521c702-20220124T12:35:27

Steps to Reproduce:

  1. In the frontend-config, set URL to window.location.pathname
  2. Post a comment.
  3. Click on the comment timestamp
  4. => Invalid URL (404)

An example can be found here: https://iwr.sh/posts/example/#remark42

Workaround:

The only workaround I can see is not using relative URLs, but I would prefer using them since I only want to associate comments with the path and not the domain.

I tried changing the href of the timestamp to only the fragment identifier (#remark42__comment-<ID>), but this would also not fix the issue since the link would be relative to the iframe URL, which is also wrong.

I'm not sure if there is a simple solution to this, maybe there should be two separate parameters for the URL used for links and the URL associated with the comment.

(similar/possible duplicate of this issue: #1692)

@irgendwr irgendwr changed the title Relative URL breaks link on coment time Relative URL breaks link on comment time May 29, 2022
@irgendwr irgendwr changed the title Relative URL breaks link on comment time Relative URL breaks link on comment timestamp May 29, 2022
@paskal
Copy link
Collaborator

paskal commented Jun 12, 2022

Hi @irgendwr, can you please verify if v1.10.1 and master are still affected? I don't think it is, but we added an absolute URL to a few places if I'm not mistaken.

@irgendwr
Copy link
Author

Hi @paskal, I can still reproduce this issue with the current version.

@paskal paskal added this to the v1.10.2 milestone Jun 12, 2022
@akellbl4
Copy link
Collaborator

akellbl4 commented Jul 10, 2022

@irgendwr it works by design. you have to include domain or just do not provide a URL and it'll be caught by default.
Maybe it's not the best implementation, but it's nothing we can do with it without breaking things that already work.

Thank you for the idea. It's a good point and I would change the behavior but probably only in v2 if we go for that.

@akellbl4 akellbl4 removed this from the v1.10.2 milestone Jul 10, 2022
@irgendwr
Copy link
Author

Thanks for your response @akellbl4, your assessment is fair. I'll close this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants