fix(seo): URL-encode tag in canonical link
Tag pages emitted <link rel="canonical" href="...tag/Foo Bar/"> with literal spaces. Wrap with encodeURIComponent so the canonical matches the encoded URL in the sitemap.
This commit is contained in:
@@ -26,7 +26,7 @@ const page = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const canonical = `${site.url}/tag/${tag}/`;
|
const canonical = `${site.url}/tag/${encodeURIComponent(tag)}/`;
|
||||||
---
|
---
|
||||||
<Layout
|
<Layout
|
||||||
title={`Tagged: ${tag} — ${site.name}`}
|
title={`Tagged: ${tag} — ${site.name}`}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ const page = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const canonical = `${site.url}/tag/${tag}/page/${currentPage}/`;
|
const canonical = `${site.url}/tag/${encodeURIComponent(tag)}/page/${currentPage}/`;
|
||||||
---
|
---
|
||||||
<Layout
|
<Layout
|
||||||
title={`Tagged: ${tag} — Page ${currentPage} — ${site.name}`}
|
title={`Tagged: ${tag} — Page ${currentPage} — ${site.name}`}
|
||||||
|
|||||||
Reference in New Issue
Block a user