We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 71e7c25 + 3fc0612 commit 0e37819Copy full SHA for 0e37819
src/SEO.astro
@@ -128,13 +128,16 @@ if (Astro.props.title) {
128
} else if (Astro.props.titleDefault) {
129
updatedTitle = Astro.props.titleDefault;
130
}
131
+
132
+const baseUrl = Astro.site ?? Astro.url;
133
+const defaultCanonicalUrl = new URL(Astro.url.pathname + Astro.url.search, baseUrl);
134
---
135
136
{updatedTitle ? <title set:html={updatedTitle} /> : null}
137
138
{Astro.props.charset ? <meta charset={Astro.props.charset} /> : null}
139
-<link rel="canonical" href={Astro.props.canonical || Astro.url.href} />
140
+<link rel="canonical" href={Astro.props.canonical || defaultCanonicalUrl.href} />
141
142
{
143
Astro.props.description ? (
0 commit comments