docs: improve NIP-39802 with URL cleaning guidance from NIP-84

- Add recommendation to clean URLs from tracking parameters
- Add URL Handling subsection with best practices
- Ensure same article from different sources maps to same progress
- Inspired by NIP-84 (Highlights) URL handling guidelines
This commit is contained in:
Gigi
2025-10-19 10:38:28 +02:00
parent 3b31eceeab
commit 85d87bac29

View File

@@ -21,6 +21,7 @@ Reading progress events use NIP-33 parameterized replaceable semantics. The `d`
- For external URLs: `url:<base64url-encoded-url>`
- `a` (optional but recommended for Nostr articles): Article coordinate `30023:<pubkey>:<identifier>`
- `r` (optional but recommended for URLs): Raw URL of the external content
- Clients SHOULD clean URLs from tracking parameters and non-essential query strings before tagging
- `client` (optional): Client application identifier
### Content
@@ -163,6 +164,14 @@ While NIP-78 (kind 30078) can store arbitrary application data, a dedicated kind
- For URLs, the base64url encoding in the `d` tag MUST use URL-safe characters (replace `+` with `-`, `/` with `_`, remove padding `=`)
- Clients SHOULD validate that `progress` is between 0 and 1
### URL Handling
When generating events for external URLs:
- Clients SHOULD clean URLs by removing tracking parameters (e.g., `utm_*`, `fbclid`, etc.) and other non-essential query strings
- The cleaned URL should be used for both the `r` tag and the base64url encoding in the `d` tag
- This ensures that the same article from different sources (with different tracking params) maps to the same reading progress event
## References
- [NIP-01: Basic protocol flow](https://github.com/nostr-protocol/nips/blob/master/01.md)