jonasmerlin / astro-seo

Makes it easy to add information that is relevant for SEO to your Astro app.
MIT License
908 stars 50 forks source link

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

Closed jaredLunde closed 2 months ago

jaredLunde commented 3 months ago

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:

jonasmerlin commented 2 months ago

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