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.
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
andAstro.site
so it is important to useAstro.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 andAstro.site
will be set to the canonicalized URL.See: