From 1352d5ca6474a0e63a48b21fe23c0fc9c52cf546 Mon Sep 17 00:00:00 2001 From: Ike Saunders Date: Tue, 30 Jul 2024 12:03:35 -0400 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20article=20byline=20fallback=20t?= =?UTF-8?q?o=20linking=20to=20/team=20if=20no=20author=20page=20present?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/gdocs/components/LinkedAuthor.tsx | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/site/gdocs/components/LinkedAuthor.tsx b/site/gdocs/components/LinkedAuthor.tsx index 07a54033396..01b66b409cb 100644 --- a/site/gdocs/components/LinkedAuthor.tsx +++ b/site/gdocs/components/LinkedAuthor.tsx @@ -25,22 +25,9 @@ export default function LinkedAuthor({ /> ) : undefined - // Somehow, using a fragment here messes up the hydration process and causes - // some links to be applied to the wrong authors, but only if the first - // author is unlinked (which probably gets tangled with the "By: " text - // above). Additional markup, here in the form of a span, works more - // reliably. - if (!author.slug) { - return ( - - {image} - {author.name} - - ) - } - const path = getCanonicalUrl("", { - slug: author.slug, + // If there's no author slug, this will link to /team/ + slug: author.slug || "", content: { type: OwidGdocType.Author }, }) return ( From b8d7a8670221c2ff49f9614b81f8e1acd42ea5c9 Mon Sep 17 00:00:00 2001 From: Ike Saunders Date: Tue, 30 Jul 2024 16:18:07 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=A8=20remove=20trailing=20slashes=20f?= =?UTF-8?q?rom=20mockSiteRouter=20requests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adminSiteServer/mockSiteRouter.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adminSiteServer/mockSiteRouter.tsx b/adminSiteServer/mockSiteRouter.tsx index d592eb60e0f..ca9ea590f8a 100644 --- a/adminSiteServer/mockSiteRouter.tsx +++ b/adminSiteServer/mockSiteRouter.tsx @@ -496,7 +496,8 @@ getPlainRouteNonIdempotentWithRWTransaction( mockSiteRouter, "/*", async (req, res, trx) => { - const slug = req.path.replace(/^\//, "") + // Remove leading and trailing slashes + const slug = req.path.replace(/^\/|\/$/g, "") try { const page = await renderGdocsPageBySlug(trx, slug)