withastro / roadmap

Ideas, suggestions, and formal RFC proposals for the Astro project.
292 stars 29 forks source link

Create "Astro.url" & Deprecate "Astro.canonicalURL" #232

Closed FredKSchott closed 2 years ago

FredKSchott commented 2 years ago

Summary

Create a general-purpose Astro.url helper. Deprecate Astro.canonicalURL to use Astro.url instead.

// Before:
const currentPathname = new URL(Astro.request.url).pathname;
const canonicalURL = Astro.canonicalURL;

// After:
const currentPathname = Astro.url.pathname;
const canonicalURL = new URL(Astro.url.pathname, Astro.site);

Links

FredKSchott commented 2 years ago

We're getting close to the Astro v1.0 RC, so would appreciate quick reviews from anyone reading, especially from @withastro/tsc. Thanks!