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;