Skip to content

Commit 3161c02

Browse files
committed
pathname canonical URL hack
1 parent 0739973 commit 3161c02

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

usehooks.com/src/layouts/Layout.astro

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ const {
1111
title,
1212
description,
1313
ogImage = new URL("/meta/og.jpg", Astro.url),
14-
url = new URL(Astro.url.pathname, Astro.site),
1514
} = Astro.props;
15+
16+
const pathname = Astro.url.pathname
17+
18+
const url = pathname[pathname.length - 1] === "/"
19+
? new URL(pathname.slice(0, pathname.length -1), Astro.site)
20+
: new URL(Astro.url.pathname, Astro.site)
21+
1622
---
1723

1824
<!DOCTYPE html>

0 commit comments

Comments
 (0)