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).
fullstack ruleP1universalStack: node
seourlcanonicalhttp
Strip duplicate-content query params from canonical URLs
A canonical URL should not blindly echo the request URL; drop params that only create duplicate content (filters, print flags) while keeping content-identifying ones.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codejavascript
| 1 | links: [{ rel: 'canonical', href: req.url }] // /page?field=x -> wrong canonical |
Explanation (EN)
Objašnjenje (HR)
Good example
New codejavascript
| 1 | const canonical = stripDuplicateContentParams(req.url); // keep ?articleId, drop ?print, ?field |
| 2 | links: [{ rel: 'canonical', href: canonical }]; |
Explanation (EN)
Objašnjenje (HR)