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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ results/ground_truth.csv
results/scenarios.csv
output/
data/
!notes/data/
!notes/data/**
# Committed sensitivity evidence (pinned by tests/test_sensitivity_evidence.py)
!sensitivity/data/

Expand Down
15 changes: 14 additions & 1 deletion app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client";

import Link from "next/link";
import {
useCallback,
useEffect,
Expand Down Expand Up @@ -353,6 +354,10 @@ export default function App() {
availableViews={availableViews}
navItems={navItems}
activeNav={activeNav}
actionLinks={[
{ label: "Paper", href: "/paper", type: "internal" },
{ label: "Notes", href: "/notes", type: "internal" },
]}
versionId={versionId}
pendingVersionId={pendingVersionId}
onSelectVersion={handleSelectVersion}
Expand Down Expand Up @@ -442,6 +447,13 @@ export default function App() {
Paper
</a>{" "}
&middot;{" "}
<Link
href="/notes"
className="text-text-secondary hover:text-primary transition-colors"
>
Notes
</Link>{" "}
&middot;{" "}
<a
href="https://policyengine.org"
className="text-text-secondary hover:text-primary transition-colors"
Expand All @@ -461,7 +473,8 @@ export default function App() {
className="text-text-secondary hover:text-primary transition-colors"
>
Expand
</a>
</a>{" "}
&middot;{" "}
<a
href="https://github.com/PolicyEngine/policybench"
className="text-text-secondary hover:text-primary transition-colors"
Expand Down
6 changes: 5 additions & 1 deletion app/src/app/model/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ export default async function ModelPage({
return (
<main id="main" className="min-h-screen bg-void">
<SiteHeader
actionLink={{ label: "Leaderboard", href: "/", type: "internal" }}
actionLinks={[
{ label: "Leaderboard", href: "/", type: "internal" },
{ label: "Paper", href: "/paper", type: "internal" },
{ label: "Notes", href: "/notes", type: "internal" },
]}
expandedContent={expanded}
alwaysExpanded
/>
Expand Down
76 changes: 76 additions & 0 deletions app/src/app/notes/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import type { Metadata } from "next";
import { notFound } from "next/navigation";

import { NoteArticle, interpolateNoteText } from "../../../components/NotesContent";
import SiteHeader from "../../../components/SiteHeader";
import { getNote, notes } from "../../../notes";

export const dynamicParams = false;

export function generateStaticParams() {
return notes.map((note) => ({ slug: note.slug }));
}

export async function generateMetadata({
params,
}: {
params: Promise<{ slug: string }>;
}): Promise<Metadata> {
const { slug } = await params;
const note = getNote(slug);
if (!note) notFound();
const description = interpolateNoteText(note, note.paragraphs[0]);
const url = `https://policybench.org/notes/${note.slug}`;
return {
title: note.title,
description,
alternates: { canonical: `/notes/${note.slug}` },
openGraph: {
type: "article",
url,
siteName: "PolicyBench",
title: note.title,
description,
publishedTime: note.date,
images: [
{
url: "/og-image.png",
width: 1200,
height: 630,
alt: "PolicyBench — an LLM benchmark for tax and benefit calculation",
},
],
},
twitter: {
card: "summary_large_image",
title: note.title,
description,
images: ["/og-image.png"],
},
};
}

export default async function NotePage({
params,
}: {
params: Promise<{ slug: string }>;
}) {
const { slug } = await params;
const note = getNote(slug);
if (!note) notFound();

return (
<main id="main" className="min-h-screen bg-void">
<SiteHeader
actionLinks={[
{ label: "Leaderboard", href: "/", type: "internal" },
{ label: "Paper", href: "/paper", type: "internal" },
]}
alwaysExpanded
/>
<div className="mx-auto max-w-3xl px-4 pb-20 pt-10 sm:px-6 sm:pt-14">
<NoteArticle note={note} titleLevel="h1" />
</div>
</main>
);
}
63 changes: 63 additions & 0 deletions app/src/app/notes/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import type { Metadata } from "next";

import {
NOTES_INTRO,
NotesPageContent,
} from "../../components/NotesContent";
import SiteHeader from "../../components/SiteHeader";

export const metadata: Metadata = {
title: "Notes",
description: NOTES_INTRO,
alternates: {
canonical: "/notes",
},
openGraph: {
type: "website",
url: "https://policybench.org/notes",
siteName: "PolicyBench",
title: "PolicyBench notes",
description: NOTES_INTRO,
images: [
{
url: "/og-image.png",
width: 1200,
height: 630,
alt: "PolicyBench — an LLM benchmark for tax and benefit calculation",
},
],
},
twitter: {
card: "summary_large_image",
title: "PolicyBench notes",
description: NOTES_INTRO,
images: ["/og-image.png"],
},
};

export default function NotesPage() {
const expanded = (
<>
<h1 className="font-[family-name:var(--font-display)] text-3xl tracking-tight text-text sm:text-4xl">
Notes
</h1>
<p className="mt-4 max-w-2xl text-sm leading-relaxed text-text-secondary sm:text-base">
{NOTES_INTRO}
</p>
</>
);

return (
<main id="main" className="min-h-screen bg-void">
<SiteHeader
actionLinks={[
{ label: "Leaderboard", href: "/", type: "internal" },
{ label: "Paper", href: "/paper", type: "internal" },
]}
expandedContent={expanded}
alwaysExpanded
/>
<NotesPageContent />
</main>
);
}
9 changes: 4 additions & 5 deletions app/src/app/paper/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ export default function PaperPage() {
<main id="main" className="min-h-screen bg-void">
<h1 className="sr-only">PolicyBench paper</h1>
<SiteHeader
actionLink={{
label: "Benchmark",
href: "/",
type: "internal",
}}
actionLinks={[
{ label: "Leaderboard", href: "/", type: "internal" },
{ label: "Notes", href: "/notes", type: "internal" },
]}
expandedContent={expanded}
alwaysExpanded
/>
Expand Down
12 changes: 12 additions & 0 deletions app/src/app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { MetadataRoute } from "next";

import rawData from "../data-summary.json";
import { listModels } from "../lib/modelPage";
import { notes } from "../notes";
import type { DashboardBundle } from "../types";

export default function sitemap(): MetadataRoute.Sitemap {
Expand All @@ -10,6 +11,11 @@ export default function sitemap(): MetadataRoute.Sitemap {
changeFrequency: "monthly" as const,
priority: 0.6,
}));
const noteEntries = notes.map((note) => ({
url: `https://policybench.org/notes/${note.slug}`,
changeFrequency: "monthly" as const,
priority: 0.5,
}));
return [
{
url: "https://policybench.org/",
Expand All @@ -21,11 +27,17 @@ export default function sitemap(): MetadataRoute.Sitemap {
changeFrequency: "monthly",
priority: 0.7,
},
{
url: "https://policybench.org/notes",
changeFrequency: "weekly",
priority: 0.7,
},
{
url: "https://policybench.org/expand",
changeFrequency: "monthly",
priority: 0.5,
},
...noteEntries,
...modelEntries,
];
}
9 changes: 7 additions & 2 deletions app/src/components/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { DEFAULT_VERSION_ID } from "../lib/dataVersionsRuntime";
import type { BenchData, CountryCode } from "../types";
import SiteHeader, { type HeaderNavItem } from "./SiteHeader";
import SiteHeader, {
type HeaderActionLink,
type HeaderNavItem,
} from "./SiteHeader";

export default function Hero({
selectedView,
Expand All @@ -9,6 +12,7 @@ export default function Hero({
availableViews,
navItems,
activeNav,
actionLinks,
versionId,
pendingVersionId,
onSelectVersion,
Expand All @@ -20,6 +24,7 @@ export default function Hero({
availableViews: CountryCode[];
navItems: readonly HeaderNavItem[];
activeNav: string;
actionLinks: readonly HeaderActionLink[];
versionId: string;
pendingVersionId: string | null;
onSelectVersion: (id: string) => void;
Expand Down Expand Up @@ -56,7 +61,7 @@ export default function Hero({
versionId={versionId}
pendingVersionId={pendingVersionId}
onSelectVersion={onSelectVersion}
actionLink={{ label: "Paper", href: "/paper", type: "internal" }}
actionLinks={actionLinks}
/>

<section
Expand Down
Loading