Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP1universalStack: javascript
urlsharingbrowsercorrectness
Build share URLs from origin + pathname, not the full href
Query params in window.location.href can break social sharers; compose share URLs from origin and pathname to drop them.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codejavascript
| 1 | const shareUrl = window.location.href; // includes ?utm=... which breaks the sharer |
Explanation (EN)
Objašnjenje (HR)
Good example
New codejavascript
| 1 | const shareUrl = `${window.location.origin}${window.location.pathname}`; |
Explanation (EN)
Objašnjenje (HR)