From c49a910dc7d834c1e1da6f715e14411e6a39e833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=20Lyovs=C3=B3n?= Date: Thu, 19 Nov 2026 23:41:41 +0400 Subject: [PATCH] fix(seo): keep thin reference and empty topic pages out of the index Search Console (Nov 19) shows 34 pages crawled or discovered but not indexed, and 50 of the 105 sitemap URLs were reference hubs with about 40 visible words: a catalog blurb plus a citing post's card. - Reference hubs count as having the Lyovsons' own words only when they show an activity note or written review. A citing post shows only its card there, and the post page is the one that should rank. - Topics without published posts are noindex and leave the sitemap. - The author layout's Suspense fallback rendered the page as well, so every author page's HTML held its content twice (two H1s, every card doubled for crawlers). The fallback is now the profile skeleton only. Co-Authored-By: Claude Opus 5.5 --- src/app/(frontend)/[lyovson]/layout.tsx | 11 +++-------- src/app/(frontend)/topics/[slug]/page.tsx | 7 ++++++- src/utilities/get-reference.ts | 20 +++++++++----------- src/utilities/sitemap-routes.ts | 3 ++- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/app/(frontend)/[lyovson]/layout.tsx b/src/app/(frontend)/[lyovson]/layout.tsx index 704e93d9..b2119df0 100644 --- a/src/app/(frontend)/[lyovson]/layout.tsx +++ b/src/app/(frontend)/[lyovson]/layout.tsx @@ -43,14 +43,9 @@ async function AuthorLayout({ children, params }: LayoutProps) { export default function Layout(props: LayoutProps) { return ( - - - {props.children} - - } - > + // The fallback must not render children too: the page would then be in + // the HTML twice (two H1s and every card doubled for crawlers). + }> ); diff --git a/src/app/(frontend)/topics/[slug]/page.tsx b/src/app/(frontend)/topics/[slug]/page.tsx index 4821a336..1c300c6f 100644 --- a/src/app/(frontend)/topics/[slug]/page.tsx +++ b/src/app/(frontend)/topics/[slug]/page.tsx @@ -110,7 +110,10 @@ export async function generateMetadata({ }: PageProps): Promise { const { slug } = await paramsPromise; - const topic = await getTopic(slug); + const [topic, posts] = await Promise.all([ + getTopic(slug), + getTopicPosts(slug), + ]); if (!topic) { return buildNotFoundMetadata({ @@ -147,6 +150,8 @@ export async function generateMetadata({ height: 630, alt: topicName, }, + // An empty topic is a page with a heading and nothing else. + ...(posts?.totalDocs ? {} : { robots: { index: false, follow: true } }), }); } diff --git a/src/utilities/get-reference.ts b/src/utilities/get-reference.ts index d1166372..d60185ae 100644 --- a/src/utilities/get-reference.ts +++ b/src/utilities/get-reference.ts @@ -91,18 +91,16 @@ export function getShownReviews(activity: Activity) { } /** - * Search engines get a hub only when it carries the Lyovsons' own words: an - * activity note or written review, or a post. A page of catalog - * facts alone stays out of the index. + * Search engines get a hub only when it shows the Lyovsons' own words: an + * activity note or written review. Catalog facts and post cards alone stay + * out of the index: a citing post shows only its card here, and the post + * page is the one that should rank. */ -export function hubHasOwnWords({ activities, posts }: ReferenceHub) { - return ( - posts.length > 0 || - activities.some( - (activity) => - Boolean(extractLexicalText(activity.notes).trim()) || - (activity.reviews ?? []).some((review) => Boolean(review.note?.trim())) - ) +export function hubHasOwnWords({ activities }: ReferenceHub) { + return activities.some( + (activity) => + Boolean(extractLexicalText(activity.notes).trim()) || + (activity.reviews ?? []).some((review) => Boolean(review.note?.trim())) ); } diff --git a/src/utilities/sitemap-routes.ts b/src/utilities/sitemap-routes.ts index cd0415f2..1dab9628 100644 --- a/src/utilities/sitemap-routes.ts +++ b/src/utilities/sitemap-routes.ts @@ -214,7 +214,8 @@ function getTopicRoutes( postCounts: Map ): Sitemap { return topics.flatMap((topic) => { - if (!topic?.slug) { + // A topic without posts is noindex, so it stays out of the sitemap. + if (!(topic?.slug && postCounts.get(topic.slug))) { return []; } const { slug } = topic;