Canonical Meta Tag Normalization

When using a SSG, the logic to determine the canonical meta tag URL looks something like this:

const canonicalUrl = new URL(Astro.url.pathname, Astro.site);

Given a file at either /blog.astroor /blog/index.astro (and depending on Astro’s config), the canonical URL could build to:

https://example.com/blog.html
https://example.com/blog
https://example.com/blog/

With “Pretty URLs” enabled, Netlify rewrites links like <a href="blog.html">Blog</a> to <a href="blog">Blog</a>. However, it doesn’t do that for the canonical meta tag. It still has the .html: <link rel="canonical" href="``https://example.com/blog.html``">. Here’s a link to an example: Blog

Could we also rewrite the canonical meta tag so it matches the route that’s actually served? (This would also be sensible even when “Pretty URLs” is disabled – perhaps with a config options letting the user choose which format to treats as canonical?)