Open Sigmanificient opened 3 months ago
It's a matter of the style only for root paths (e.g. example.com
and example.com/
are equivalent).
For non-root paths they might point to different pages. Examples found in the Nixpkgs repo:
https://torger.se/anders/brutefir.html
is valid.https://torger.se/anders/brutefir.html/
is not valid.https://archlinux.org/pacman/
is valid.https://archlinux.org/pacman
is not valid.If both are available, I'd suggest to use a canonical one or the one that responds with 200 OK rather than 301 Moved Permanently.
FWIW, I consider https://example.com/
canonical for root paths, and my understanding is that the WHATWG URL Standard concurs (new URL("https://example.com").href === "https://example.com/"
, .origin === "https://example.com"
, .pathname === "/"
, the results are the same for "https://example.com/"
). Plus it just makes sense, since it results in GET /
.
But yes, other than that they’re absolutely not equivalent, so it doesn’t make sense to have a general rule. We could do a tree‐wide sweep to resolve 301 redirects or pick one arbitrarily when both are valid and return the exact same content, but I’m unconvinced it’s worth it.
'Canonical' refers to <link rel="canonical"/>
(or a 301's target), i.e. a choice made by webmasters, rather than anything that's canonical to a spec.
Issue description
Seems like a third of packages have
meta.homepage
that endswith a trailing/
.Steps to reproduce
In the doc, the given example also endswith a trailing
/
: https://nixos.org/manual/nixpkgs/stable/#var-meta-homepageNewest
CONTRIBUTING.md
, also use the trailing/
in editorconfig url:Normalizing them either way would be nice