Skip to content

Conversation

@Aspie96
Copy link
Contributor

@Aspie96 Aspie96 commented Nov 30, 2025

The fragment of a URL can actually be an important part that identifies the page (as opposed to just an anchor to part of the page).

This can happen, for example, with static single-page websites with client-side rendering implemented with libraries such as Vue or Angular, unless redirecting is used.

The fragment of a URL can actually be an important part that identifies the page (as opposed to just an anchor to part of the page).

This can happen, for example, with static single-page websites with client-side rendering implemented with libraries such as Vue or Angular, unless redirecting is used.
@vitorpamplona
Copy link
Collaborator

There is generally a lot of gibberish on fragments that we don't want to keep and that's why the recommendation is to remove it.

The issue is that many fragments, and sometimes query parameters, change from time to time, which creates diverging comment threads on Nostr. When sharing videos, for instance, YouTube creates links with tracking codes in query parameters. If we keep them, NIP-22 comments will be scoped for each tracking code. Similarly, many websites treat fragments as a reference point inside the text. If we keep them, NIP-22 comments will only show replies to that specific point in the text.

To ensure everyone discussing the same resource (video, article, etc.) shares a single, unified comment thread, the URL must be canonicalized. This means transforming the URL into its simplest, most essential form that uniquely identifies the content. Historically, that has been done by simply removing fragments. But we might need other ways of doing it.

@Aspie96
Copy link
Contributor Author

Aspie96 commented Dec 1, 2025

I am aware of the issue and why the fragment is currently removed as well as why it's asked that the URL be normalized.

The truth, however, is you cannot just assume the fragment and query parameters are irrelevant, since some websites use them as a crucial part of the URL. You can dislike this practice, but it's the way it is.

If one is embedding Nostr comments, or linking a Nostr commenting feature, on their website, then they will know how to properly normalize URLs so that each resource has one exact URL.

If the user is pasting the URL manually, then it'll be up to the user. In that case the client can, maybe should, attempt obvious normalization, but it cannot just silently remove the fragment, as that may lead to linking to the wrong page.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants