Shared lexicon schemas for long-form publishing on AT Protocol. Uses typescript to json via prototypey.

Why recommend avoid trailing slashes on publications? #13

Open mb21.bsky.social
Open opened by mb21.bsky.social

The Standard.site schema currently says about publication.url: "Avoid trailing slashes", and about document.path: "Combine with site or publication url to construct a canonical URL to the document. Prepend with a leading slash."

I see two problems with that recommendation:

  1. https://example.com is in fact not a valid fully qualified URL, because the path always needs to start with a slash. That's why new URL("https://example.com").toString() normalizes this correctly to https://example.com/. This is a problem if I want my library to accept publication.url as a JS URL object instead of as a string.
  2. What if my publication's URL is in fact https://mastrojs.github.io/blog/ (with a trailing slash)? Yes, some websites may redirect /blog to /blog/, but not all will.

That's why I'd advocate for just dropping that recommendation. People should just make sure that publication.url + document.path (string concatenation) resolves to the correct thing.

Sign up or Sign in to add to the discussion.