Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/app/benchmarks/[slug]/[chain]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { notFound, redirect } from "next/navigation";
import Link from "next/link";
import { ArrowLeft, ArrowUpRight } from "lucide-react";
import { getBenchmark } from "@/data/benchmarks";
Expand Down Expand Up @@ -326,6 +326,14 @@ export default async function BenchmarkChainPage({
params: Promise<Params>;
}) {
const { slug, chain } = await params;
// 308 non-canonical casings + legacy aliases (e.g. /ETH → /eth, /ton →
// /gram) to the canonical lowercase slug so Google indexes one URL per
// chain. matchesChainSlug() is case-insensitive so both render before
// this redirect — without it, /perp-fees/ETH + /perp-fees/eth both 200
// and Ahrefs flags the lowercase variants as orphans (parent links use
// the YAML's uppercase value).
const canon = canonicalChainSlug(chain);
if (canon !== chain) redirect(`/benchmarks/${slug}/${canon}`);
const data = await loadChainPage(slug, chain);
if (!data) notFound();
const { benchmark, explainer } = data;
Expand Down Expand Up @@ -601,7 +609,7 @@ function SiblingChains({
{siblings.map((c) => (
<li key={c.value}>
<Link
href={`/benchmarks/${benchmark.slug}/${c.value}`}
href={`/benchmarks/${benchmark.slug}/${canonicalChainSlug(c.value)}`}
className="inline-block rounded-md card-soft px-3 py-1.5 text-sm text-ink-soft hover:text-ink"
>
{c.label}
Expand Down
3 changes: 2 additions & 1 deletion src/app/benchmarks/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { SITE } from "@/data/site";
import { buildBreadcrumbJsonLd, buildFaqPageJsonLd, safeJsonLd } from "@/lib/jsonld";
import { buildBenchDatasetJsonLd } from "@/lib/dataset-jsonld";
import { renderTemplate } from "@/lib/bench-template";
import { canonicalChainSlug } from "@/lib/chain-aliases";
import type { Benchmark } from "@/types/benchmark";

// ISR with a 60 s revalidate window. The page is prerendered by
Expand Down Expand Up @@ -604,7 +605,7 @@ function PerChainPagesNav({ benchmark }: { benchmark: Benchmark }) {
{chains.map((c) => (
<li key={c.value}>
<Link
href={`/benchmarks/${benchmark.slug}/${c.value}`}
href={`/benchmarks/${benchmark.slug}/${canonicalChainSlug(c.value)}`}
className="inline-block rounded-md card-soft px-3 py-1.5 text-sm text-ink-soft hover:text-ink"
>
{c.label}
Expand Down
Loading