From fa1886f691f886cd37141c7ecbd2a9a38ddbbbb4 Mon Sep 17 00:00:00 2001 From: Laurance Walden <6620582+lwalden@users.noreply.github.com> Date: Wed, 15 Apr 2026 20:31:58 -0700 Subject: [PATCH] fix(seo): align breadcrumb and schema URLs with canonical trailing slashes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Breadcrumb JSON-LD item URLs were missing trailing slashes (e.g. https://lwalden.dev/posts) while canonical tags and sitemap URLs included them (https://lwalden.dev/posts/). This mismatch causes Google to see inconsistent URL signals across structured data, canonical, and sitemap — hurting indexing confidence. Also fixes Organization and Person schema URLs to include trailing slash, matching the homepage canonical. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/lib/schemas.ts | 4 ++-- src/pages/about.astro | 2 +- src/pages/posts/[...slug]/index.astro | 2 +- src/pages/posts/index.astro | 2 +- src/pages/posts/tag/[tag]/index.astro | 2 +- src/pages/projects.astro | 2 +- src/pages/projects/[slug]/index.astro | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/schemas.ts b/src/lib/schemas.ts index dba2583..3161312 100644 --- a/src/lib/schemas.ts +++ b/src/lib/schemas.ts @@ -56,7 +56,7 @@ export function getPersonSchema() { '@context': 'https://schema.org', '@type': 'Person', name: SITE.author, - url: SITE.website, + url: `${SITE.website}/`, sameAs: Object.values(SITE.social), }; } @@ -79,7 +79,7 @@ export function getOrganizationSchema() { '@context': 'https://schema.org', '@type': 'Organization', name: SITE.title, - url: SITE.website, + url: `${SITE.website}/`, logo: { '@type': 'ImageObject', url: `${SITE.website}/${SITE.ogImage}`, diff --git a/src/pages/about.astro b/src/pages/about.astro index 079d5fc..dd66605 100644 --- a/src/pages/about.astro +++ b/src/pages/about.astro @@ -6,7 +6,7 @@ import { render, getEntry } from 'astro:content'; import { getBreadcrumbSchema } from '@/lib/schemas'; const schema = getBreadcrumbSchema([ - { name: 'About', url: new URL('/about', Astro.site).toString() }, + { name: 'About', url: new URL('/about/', Astro.site).toString() }, ]); import { Image } from 'astro:assets'; import profilePhoto from '@/site-assets/profile_photo.png'; diff --git a/src/pages/posts/[...slug]/index.astro b/src/pages/posts/[...slug]/index.astro index d2869e3..5e23359 100644 --- a/src/pages/posts/[...slug]/index.astro +++ b/src/pages/posts/[...slug]/index.astro @@ -41,7 +41,7 @@ const schemas = [ tags: post.data.tags, }), getBreadcrumbSchema([ - { name: 'Blog', url: new URL('/posts', Astro.site).toString() }, + { name: 'Blog', url: new URL('/posts/', Astro.site).toString() }, { name: post.data.title, url: new URL(Astro.url.pathname, Astro.site).toString() }, ]), ]; diff --git a/src/pages/posts/index.astro b/src/pages/posts/index.astro index a530449..f9d2514 100644 --- a/src/pages/posts/index.astro +++ b/src/pages/posts/index.astro @@ -8,7 +8,7 @@ import { SITE } from '@/config'; import { getBreadcrumbSchema } from '@/lib/schemas'; const schema = getBreadcrumbSchema([ - { name: 'Blog', url: new URL('/posts', Astro.site).toString() }, + { name: 'Blog', url: new URL('/posts/', Astro.site).toString() }, ]); const posts = (await getPublishedPosts()).sort( diff --git a/src/pages/posts/tag/[tag]/index.astro b/src/pages/posts/tag/[tag]/index.astro index fa37305..6bc7be0 100644 --- a/src/pages/posts/tag/[tag]/index.astro +++ b/src/pages/posts/tag/[tag]/index.astro @@ -26,7 +26,7 @@ export const getStaticPaths = (async () => { const { tag, posts } = Astro.props; const schema = getBreadcrumbSchema([ - { name: 'Blog', url: new URL('/posts', Astro.site).toString() }, + { name: 'Blog', url: new URL('/posts/', Astro.site).toString() }, { name: tag, url: new URL(Astro.url.pathname, Astro.site).toString() }, ]); --- diff --git a/src/pages/projects.astro b/src/pages/projects.astro index e17462c..00044b9 100644 --- a/src/pages/projects.astro +++ b/src/pages/projects.astro @@ -6,7 +6,7 @@ import { SITE } from '@/config'; import { getBreadcrumbSchema } from '@/lib/schemas'; const schema = getBreadcrumbSchema([ - { name: 'Projects', url: new URL('/projects', Astro.site).toString() }, + { name: 'Projects', url: new URL('/projects/', Astro.site).toString() }, ]); const projects = (await getCollection('projects')).sort((a, b) => a.data.order - b.data.order); diff --git a/src/pages/projects/[slug]/index.astro b/src/pages/projects/[slug]/index.astro index 0e9ddbd..a2a3a43 100644 --- a/src/pages/projects/[slug]/index.astro +++ b/src/pages/projects/[slug]/index.astro @@ -22,7 +22,7 @@ const project = Astro.props as Props; const { Content } = await render(project); const schema = getBreadcrumbSchema([ - { name: 'Projects', url: new URL('/projects', Astro.site).toString() }, + { name: 'Projects', url: new URL('/projects/', Astro.site).toString() }, { name: project.data.title, url: new URL(Astro.url.pathname, Astro.site).toString() }, ]); ---