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

fix: use Astro.site property to generate default canonical urls #95

Merged
merged 1 commit into from
Jun 1, 2024

Conversation

jaredLunde
Copy link
Contributor

@jaredLunde jaredLunde commented Apr 24, 2024

People are able to define a site URL in their Astro config, which should be preferred as the base URL for the canonical URL if it exists. This is the same URL that Astro itself uses for canonicalizing URLs and generating sitemaps. They strongly recommend setting this property in their config file.

Discrepancies can arise between Astro.url and Astro.site so it is important to use Astro.site if it exists. An example of this is preview websites on Vercel where you don't want the site to be indexed to avoid duplicated content penalties. Astro.url will be set to the preview URL and Astro.site will be set to the canonicalized URL.

See:

@jaredLunde jaredLunde changed the title fix: use Astro.site property to generate canonical urls fix: use Astro.site property to generate default canonical urls Apr 24, 2024
@jonasmerlin jonasmerlin merged commit 0e37819 into jonasmerlin:main Jun 1, 2024
@jonasmerlin
Copy link
Owner

Thank you for your contribution @jaredLunde! This PR went live with https://github.com/jonasmerlin/astro-seo/releases/tag/v0.8.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants