Give each route its own title and canonical, and add robots.txt plus a sitemap.
The root layout was stamping the homepage title and production root onto every page. Routes now supply a page segment through one em-dash template, canonicals follow the request path, and non-production hosts disallow crawlers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+8
-7
@@ -3,6 +3,7 @@ import type { Metadata, Viewport } from "next";
|
||||
import type { ReactNode } from "react";
|
||||
import messages from "../messages/en/index";
|
||||
import { ASSETS, getAssetPath } from "../lib/assetUtils";
|
||||
import { PRODUCTION_SITE_ORIGIN } from "../lib/siteMetadata";
|
||||
import "./globals.css";
|
||||
|
||||
// `force-dynamic` is now scoped to `(app)/layout.tsx` and `(admin)/layout.tsx`
|
||||
@@ -54,7 +55,10 @@ export const viewport: Viewport = {
|
||||
};
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: homeMeta.title,
|
||||
title: {
|
||||
default: homeMeta.title,
|
||||
template: messages.metadata.titleTemplate,
|
||||
},
|
||||
description: homeMeta.description,
|
||||
keywords: [...homeMeta.keywords],
|
||||
authors: [{ name: "Media Economies Design Lab" }],
|
||||
@@ -65,7 +69,7 @@ export const metadata: Metadata = {
|
||||
address: false,
|
||||
telephone: false,
|
||||
},
|
||||
metadataBase: new URL("https://communityrule.com"),
|
||||
metadataBase: new URL(PRODUCTION_SITE_ORIGIN),
|
||||
icons: {
|
||||
icon: [
|
||||
{ url: getAssetPath(ASSETS.LOGO), type: "image/svg+xml" },
|
||||
@@ -89,14 +93,11 @@ export const metadata: Metadata = {
|
||||
},
|
||||
],
|
||||
},
|
||||
alternates: {
|
||||
canonical: "/",
|
||||
},
|
||||
openGraph: {
|
||||
title: homeMeta.title,
|
||||
description: homeMeta.description,
|
||||
url: "https://communityrule.com",
|
||||
siteName: "CommunityRule",
|
||||
url: PRODUCTION_SITE_ORIGIN,
|
||||
siteName: messages.metadata.siteName,
|
||||
locale: "en_US",
|
||||
type: "website",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user