seo: enforce trailing slash on all URLs
Deploy / verify (push) Successful in 37s
Deploy / deploy (push) Successful in 55s

- Set trailingSlash='always' globally via root layout.
- Update postHref, pageHref, Pagination, tag/breadcrumb hrefs, blog→posts
  redirects to emit trailing slash.
- Match old Astro canonical so indexed URLs hit 200 directly instead of
  308-redirect.
This commit is contained in:
Peter Meier
2026-04-17 22:23:16 +02:00
parent d28a55a70a
commit f328989aa8
12 changed files with 24 additions and 19 deletions
+3 -3
View File
@@ -19,8 +19,8 @@
} = $props();
function tagHref(tagSlug: string | null): string {
if (!tagSlug) return basePath;
return `${basePath}/tag/${encodeURIComponent(tagSlug)}`;
if (!tagSlug) return `${basePath}/`;
return `${basePath}/tag/${encodeURIComponent(tagSlug)}/`;
}
function pageHref(page: number): string {
@@ -28,7 +28,7 @@
const tagPart = activeTag
? `/tag/${encodeURIComponent(activeTag)}`
: "";
return `${basePath}${tagPart}/page/${page}`;
return `${basePath}${tagPart}/page/${page}/`;
}
const showPagination = $derived(totalPages > 1);