# Add the "Sitemap Links" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/sitemap-links) to this Pantheon Content Publisher (P1) Next.js project. An HTML site map listing every section of the site and its pages in columns.

## Steps

1. Create `components/puck/sitemap-links-block.tsx` with the exact file contents below. If `components/puck/` doesn't exist, find the folder where this project keeps its Puck components (look at the imports in `puck.config.tsx`) and put it there.
2. In `puck.config.tsx`, import it: `import { sitemapLinksBlock } from "./components/puck/sitemap-links-block";`
3. Register it under `components` as `SitemapLinksBlock: sitemapLinksBlock`.
4. Add `"SitemapLinksBlock"` to the best-fitting entry in `categories` (this block's library category is "Civic & utility"). Create a category only if none fits.
5. Run the project's type check (usually `pnpm typecheck`) and resolve anything project-specific.
6. If `package.json` has a `sync:registry` script, tell the user it must run (or that CI will run it) before the new component appears in the P1 editor.

## Rules

- Do not add dependencies. The block is self-contained by design: one type-only import from `@puckeditor/core`, Tailwind v4 classes, no client JavaScript.
- Keep the files as-is unless the user asks for changes. The accent color is `indigo-*`; if the project has brand colors, offer to swap them with a find-and-replace on `indigo-`.
- Images are plain `imageUrl` + `imageAlt` text fields. If this project defines a P1 media-library field (search for `"p1-media"`), offer to switch to it.
- Don't change prop names in `defaultProps`. Content editors' saved pages depend on them.

## File: `components/puck/sitemap-links-block.tsx`

```tsx
import type { ComponentConfig } from "@puckeditor/core";

/**
 * Sitemap Links — an HTML site map: every section of the site with its pages, in columns.
 * Gives people (and search engines) one page that reaches everything.
 * Register: `SitemapLinksBlock: sitemapLinksBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";

export type SitemapLinksProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  columns: "2" | "3" | "4";
  sections: { title: string; href: string; links: { label: string; href: string }[] }[];
};

const childLevel = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" } as const;
const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";
const gridCols = { "2": "sm:grid-cols-2", "3": "sm:grid-cols-2 lg:grid-cols-3", "4": "sm:grid-cols-2 lg:grid-cols-4" } as const;

export const sitemapLinksBlock: ComponentConfig<SitemapLinksProps> = {
  label: "Sitemap Links",
  fields: {
    heading: { type: "text", label: "Heading" },
    headingLevel: {
      type: "select",
      label: "Heading level",
      options: [
        { label: "H1", value: "h1" },
        { label: "H2", value: "h2" },
        { label: "H3", value: "h3" },
        { label: "H4", value: "h4" },
      ],
      metadata: { help: "Sets the page outline for screen readers and search. The look doesn't change." },
    },
    intro: { type: "textarea", label: "Intro" },
    columns: {
      type: "radio",
      label: "Columns",
      options: [
        { label: "2", value: "2" },
        { label: "3", value: "3" },
        { label: "4", value: "4" },
      ],
      metadata: { help: "Columns on wide screens. Phones always show one column." },
    },
    sections: {
      type: "array",
      label: "Sections",
      min: 1,
      max: 16,
      getItemSummary: (item) => (item?.title ? `${item.title} (${item?.links?.length ?? 0})` : "Section"),
      defaultItemProps: { title: "New section", href: "", links: [{ label: "New page", href: "/" }] },
      arrayFields: {
        title: { type: "text", label: "Section name" },
        href: { type: "text", label: "Section link", metadata: { help: "Optional. Makes the section name a link to its landing page." } },
        links: {
          type: "array",
          label: "Pages",
          min: 1,
          max: 30,
          getItemSummary: (item) => item?.label || "Page",
          defaultItemProps: { label: "New page", href: "/" },
          arrayFields: {
            label: { type: "text", label: "Label" },
            href: { type: "text", label: "Link" },
          },
        },
      },
    },
  },
  defaultProps: {
    heading: "Site map",
    headingLevel: "h1",
    intro: "Every page on our site, grouped by section. Can't find what you need? Call (513) 555-0187 and we'll point you in the right direction.",
    columns: "3",
    sections: [
      {
        title: "Parks & trails",
        href: "/parks",
        links: [
          { label: "Find a park", href: "/parks/map" },
          { label: "Trail conditions", href: "/parks/trails" },
          { label: "Dog parks", href: "/parks/dogs" },
          { label: "Shelter & field rentals", href: "/parks/shelters" },
          { label: "Park rules", href: "/parks/rules" },
        ],
      },
      {
        title: "Programs",
        href: "/programs",
        links: [
          { label: "Youth & teens", href: "/programs/youth" },
          { label: "Adults & seniors", href: "/programs/adults" },
          { label: "Adaptive recreation", href: "/programs/adaptive" },
          { label: "Aquatics", href: "/programs/aquatics" },
          { label: "Financial aid", href: "/programs/aid" },
        ],
      },
      {
        title: "Events",
        href: "/events",
        links: [
          { label: "Events calendar", href: "/events" },
          { label: "Summer concert series", href: "/events/concerts" },
          { label: "Volunteer cleanups", href: "/events/cleanups" },
        ],
      },
      {
        title: "Get involved",
        href: "",
        links: [
          { label: "Volunteer", href: "/volunteer" },
          { label: "Donate", href: "/donate" },
          { label: "Jobs", href: "/jobs" },
          { label: "Newsletter", href: "/newsletter" },
        ],
      },
      {
        title: "About us",
        href: "/about",
        links: [
          { label: "Leadership & staff", href: "/about/staff" },
          { label: "Park Board meetings", href: "/board" },
          { label: "Budget & reports", href: "/about/reports" },
          { label: "Contact us", href: "/contact" },
        ],
      },
      {
        title: "Policies",
        href: "",
        links: [
          { label: "Accessibility statement", href: "/accessibility" },
          { label: "Privacy policy", href: "/privacy" },
          { label: "Public records requests", href: "/records" },
        ],
      },
    ],
  },
  render: ({ heading, headingLevel, intro, columns, sections }) => {
    const H = headingLevel || "h1";
    const Sub = childLevel[H] ?? "h2";
    const list = (sections ?? []).filter((s) => s?.title);
    const cols = gridCols[columns] ?? gridCols["3"];

    return (
      <section className="bg-white px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <div className="mx-auto max-w-7xl">
          {heading || intro ? (
            <div className="max-w-2xl">
              {heading ? <H className="text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl">{heading}</H> : null}
              {intro ? <p className="mt-4 text-base leading-7 text-pretty text-neutral-600">{intro}</p> : null}
            </div>
          ) : null}
          {list.length ? (
            <div className={`grid grid-cols-1 gap-x-8 gap-y-12 ${cols} ${heading || intro ? "mt-12 border-t border-neutral-200 pt-12" : ""}`}>
              {list.map((s, i) => {
                const pages = (s.links ?? []).filter((l) => l?.label);
                return (
                  <div key={`${s.title}-${i}`} className="min-w-0">
                    <Sub className="border-b border-neutral-200 pb-3 text-base font-semibold text-neutral-950">
                      {s.href ? (
                        <a href={s.href} className={`group inline-flex min-h-11 items-center gap-1.5 rounded hover:text-indigo-700 ${focusRing}`}>
                          {s.title}
                          <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 text-neutral-400 transition group-hover:translate-x-0.5 group-hover:text-indigo-600">
                            <path fillRule="evenodd" d="M3 10a.75.75 0 0 1 .75-.75h10.64l-3.22-3.22a.75.75 0 1 1 1.06-1.06l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 1 1-1.06-1.06l3.22-3.22H3.75A.75.75 0 0 1 3 10Z" clipRule="evenodd" />
                          </svg>
                        </a>
                      ) : (
                        <span className="inline-flex min-h-11 items-center">{s.title}</span>
                      )}
                    </Sub>
                    {pages.length ? (
                      <ul role="list" className="mt-2">
                        {pages.map((p, j) => (
                          <li key={`${p.label}-${j}`}>
                            <a
                              href={p.href || "#"}
                              className={`inline-flex min-h-11 items-center rounded text-sm break-words text-neutral-700 underline-offset-4 transition hover:text-indigo-700 hover:underline ${focusRing}`}
                            >
                              {p.label}
                            </a>
                          </li>
                        ))}
                      </ul>
                    ) : null}
                  </div>
                );
              })}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
