Skip to content
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

Merged
merged 2 commits into from
Jul 21, 2022

Conversation

FredKSchott
Copy link
Member

@FredKSchott FredKSchott commented Jul 18, 2022

@changeset-bot
Copy link

changeset-bot bot commented Jul 18, 2022

🦋 Changeset detected

Latest commit: 85eede3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
astro Patch
@e2e/astro-component Patch
@e2e/error-react-spectrum Patch
@e2e/error-sass Patch
@e2e/errors Patch
@e2e/lit-component Patch
@e2e/preact-component Patch
@e2e/react-component Patch
@e2e/solid-component Patch
@e2e/svelte-component Patch
@e2e/e2e-tailwindcss Patch
@e2e/ts-resolution Patch

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

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) pkg: example Related to an example package (scope) labels Jul 18, 2022
@FredKSchott FredKSchott force-pushed the rename-canonical-url branch from 9714672 to 7722191 Compare July 18, 2022 17:49
@FredKSchott FredKSchott force-pushed the rename-canonical-url branch from cf6add2 to 06f8893 Compare July 18, 2022 19:22
@FredKSchott FredKSchott force-pushed the rename-canonical-url branch from 06f8893 to 3bc3e31 Compare July 20, 2022 03:57
Copy link
Contributor

@tony-sull tony-sull left a 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.
Copy link
Contributor

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)

Copy link
Contributor

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.');
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too.

@matthewp matthewp requested a review from tony-sull July 21, 2022 12:21
Copy link
Contributor

@tony-sull tony-sull left a 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!

@natemoo-re natemoo-re mentioned this pull request Jul 21, 2022
20 tasks
@matthewp matthewp merged commit ddefb17 into main Jul 21, 2022
@matthewp matthewp deleted the rename-canonical-url branch July 21, 2022 17:46
@astrobot-houston astrobot-houston mentioned this pull request Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pkg: example Related to an example package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants