-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace/Rename Astro.canonicalURL with new Astro.url helper #3959
Conversation
🦋 Changeset detectedLatest commit: 85eede3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
9714672
to
7722191
Compare
cf6add2
to
06f8893
Compare
06f8893
to
3bc3e31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! Added a couple tiny DX-related notes but the code and tests look great
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#astrocanonicalurl) | ||
/** | ||
* Canonical URL of the current page. | ||
* @deprecated Use `Astro.url` instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this may be a nice place for an example using new URL(Astro.url.pathname, Astro.site)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated this with an example.
@@ -220,6 +214,13 @@ ${extra}` | |||
slots: astroSlots, | |||
} as unknown as AstroGlobal; | |||
|
|||
Object.defineProperty(Astro, 'canonicalURL', { | |||
get: function() { | |||
console.warn('Astro.canonicalURL is deprecated! Use \`Astro.url\` instead.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: same as above, an example recreating the canonical may be useful for anyone hitting this API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks for the extra hints for the error messages!
Changes
Testing
Docs