# Fort Adams Trust Website

The complete guide to the Fort Adams Trust website (fortadams.org): what it does, how staff update it, and how developers maintain it.

**Staff and content editors:** start with *Website Overview*, then use the *Administrator Guide*. **Developers:** read the *Developer Guide* and the *Reference* chapter.

# Website Overview

For everyone. What the website is, what each page does, which outside services it relies on, and where each kind of content is managed.

# About This Book

This book documents the Fort Adams Trust public website: what it does, how staff keep it up to date, and how developers maintain and deploy it.

## Who this book is for

| If you are… | Read |
| --- | --- |
| **Anyone new to the website** | This chapter, *Website Overview* |
| **Staff who update website content** (events, alerts, staff list, sponsors, tour links) | *Administrator Guide* |
| **A developer** changing code, integrations, or hosting | *Developer Guide*, then *Reference* |
| **Planning the launch or an audit** | *Reference → Known Issues and Open Items* and *Launch Checklist* |

You do not need any technical knowledge to follow the *Administrator Guide*. The *Developer Guide* assumes familiarity with Git, Node.js, React, and TypeScript.

## The website in one paragraph

The site at **www.fortadams.org** is the public home of Fort Adams Trust, the nonprofit that operates and preserves Fort Adams in Newport, Rhode Island. It helps people plan a visit and book tours, find events, explore the fort's history, inquire about hosting a wedding or private event, and support the Trust with a donation, membership, volunteering, or sponsorship. It replaced the Trust's older WordPress site.

## How the content is split

Most of the website's content falls into one of three buckets:

1. **Content staff edit themselves** in the Content Manager at `/admin`: the alert banner, tour booking links, special events and categories, the staff and board directory, and corporate sponsors.
2. **Content managed in other systems.** Tours, prices, and checkout live in **FareHarbor**. Donations, memberships, and lead follow-up live in **HighLevel** (crm.fortadams.org).
3. **Content built into the site's code**, such as page text, hours, FAQs, venues, history chapters, and membership tier descriptions. A developer changes these on request.

*Where Everything Is Managed* lists each item and which bucket it belongs to.

## Conventions used in this book

- `Code style` marks something you type or see exactly as written: a file name, a web address, or a button label.
- **Bold** marks a menu, button, or field name in an app.
- Paths such as `content/events.json` are locations in the website's code repository.
- Coloured boxes highlight important information:

<p class="callout info">Info boxes give helpful context.</p>

<p class="callout warning">Warning boxes flag things that can cause problems if missed.</p>

<p class="callout danger">Danger boxes flag things that can break the site or lose data.</p>

# The Website at a Glance

A tour of every public page and what visitors can do there.

## Site-wide elements

These appear on every page:

- **Alert banner.** An optional one-line announcement across the top of the page, such as a closure or a season opening. Visitors can dismiss it. Staff control it in the Content Manager.
- **Header.** The logo, the main menu, and two buttons that always stay visible: **Donate** (goes to Support Us) and **Buy Tickets** (opens the FareHarbor booking window). On phones and small tablets, the menu collapses into a menu button.
- **Main menu.** Visit · Events · Explore the Fort · History · Host an Event · Support Us · About.
- **Footer.** Address, phone, email, social links, quick links, the copyright line, and links to the Privacy Policy and sitemap.

## Pages

| Page | Address | What it's for |
| --- | --- | --- |
| **Home** | `/` | The front door. Hero photo with *Buy Tickets* and *Plan your visit* buttons; a quick-facts strip (hours, directions, admission, parking); the **Explore the Fort** interactive video map; the next six upcoming events; "choose your path" cards (visit, host, support); a venue teaser; and fortress-story cards. |
| **Visit** | `/visit/` | Everything for planning a trip, in four tabs: **Tours & Tickets** (guided, self-guided, and private/group tour cards with *Book now* buttons), **Hours & Season**, **Getting Here** (Google map, car, water shuttle, bike, address), and **FAQ** (about 30 questions in three groups). |
| **Events** | `/events/` | Public special events. List or calendar view, category filter buttons, one optional featured event, events grouped by month, an email sign-up box, and a link to host your own event. |
| **Explore the Fort** | `/#explore-the-fort` | A section of the Home page: six short videos placed on an illustrated fort map (East Gate, Officers' Quarters, Overlook, Southeast Demi-Bastion, Tunnels, West Wall). |
| **Architecture & Terminology** | `/architecture-and-terminology/` | How the fort was built to defend, plus an A-to-Z glossary of about 100 fortification terms. |
| **History** | `/history/` | An interactive story in chapters, from the 1799 origins to today, linked to hotspots on the fort map. Also covers the Trust's history and a timeline of restoration projects since 1995. |
| **Host an Event** | `/host-an-event/` | Weddings and private events. Event types, three venues (Parade Field, North Casemates, North Lawn) with capacities and photos, what's included, and an inquiry form that goes straight into HighLevel. |
| **Support Us** | `/support-us/` | Ways to give, in tabs: **Donate** (link to the secure donation form, impact examples, donor-advised fund details), **Membership** (four annual tiers with *Join* buttons), **Corporate Giving** (sponsor logo wall), and **Volunteer**/corporate inquiry forms. |
| **About** | `/about/` | Mission and vision, links to the Strategic Plan and FY25 Annual Report (PDFs), the staff directory, and the board list. |
| **Content Manager** | `/admin/` | The staff editing area. `/admin/` is the Staff workspace (task list and help); the editor itself is at `/admin/edit/` and requires sign-in. Hidden from search engines. |

## What visitors can *do* on the site

| Action | Where | What happens behind the scenes |
| --- | --- | --- |
| Book a tour | *Buy Tickets*, *Book now* buttons | FareHarbor's booking window opens over the page. Payment and confirmation are handled entirely by FareHarbor. |
| Donate | Support Us → Donate | The visitor goes to the HighLevel donation form on `crm.fortadams.org`. |
| Become a member | Support Us → Membership | The visitor goes to a HighLevel checkout for that tier. HighLevel creates the contact and an annual subscription. |
| Inquire about an event | Host an Event → Inquire | The site creates a contact and an opportunity in the HighLevel events pipeline. |
| Volunteer / corporate inquiry | Support Us | The submission is sent to a HighLevel inbound webhook. |
| Newsletter sign-up | Events sidebar | The submission is sent to a HighLevel inbound webhook. |
| Get directions | Visit → Getting Here, Home quick facts | Opens Google Maps. |

# How the Website Works

A plain-language picture of the moving parts. Developers will find the technical version in *Developer Guide → Architecture Overview*.

## The short version

The website is a set of **pre-built pages**. It has no database and no web server running code for each visitor. Whenever the site's content changes, the whole site is rebuilt automatically and copied to Cloudflare's worldwide network. That makes it fast, secure, and nearly free to host.

The trade-off: **nothing on the site changes until a rebuild happens.** Every edit, whether a staff change in the Content Manager or a developer's code change, triggers a rebuild that usually takes a few minutes.

## The pieces

```
     Staff editor                                    Developer
          │                                              │
          ▼                                              ▼
  Content Manager (/admin) ── saves to ──▶  GitHub repository  ◀── pushes code
     (Decap CMS)                        (pmgasset/fortadamswebsite)
                                                 │
                                                 │ every change to "main"
                                                 ▼
                                       Cloudflare Pages
                                  builds the site (~ a few minutes)
                                  and serves it worldwide
                                                 │
                                                 ▼
                                   Visitors at www.fortadams.org
                                                 │
       ┌───────────────────┬─────────────────────┼────────────────────┐
       ▼                   ▼                     ▼                    ▼
   FareHarbor          HighLevel            Cloudflare R2         Google Maps
  tour booking   donations, memberships,   videos, PDFs,          map + directions
   & payment      event inquiries, leads   large media
```

| Piece | What it does |
| --- | --- |
| **GitHub** | Stores the website's code and content files, with a full history of every change. It is the single source of truth. |
| **Content Manager (Decap CMS)** | A friendly editing screen at `/admin`. When you save, it writes your change to GitHub for you. |
| **Cloudflare Pages** | Watches GitHub. On every change, it builds the site and publishes it. It also runs the one small piece of server code the site has, the event-inquiry handler. |
| **Cloudflare R2** | File storage for large media at `cdn.r2.fortadams.org`: the Explore the Fort videos, and the Strategic Plan and Annual Report PDFs. |
| **FareHarbor** | The tour catalogue, availability, pricing, checkout, and confirmations. The site only opens FareHarbor's booking window. |
| **HighLevel** (crm.fortadams.org) | The CRM. It holds contacts, event-inquiry opportunities, donations, membership subscriptions, and follow-up automations. |

## What this means day to day

- **Edits take a few minutes to appear.** See *How Your Changes Get Published*.
- **The site never touches card details.** All payments happen on FareHarbor or HighLevel pages.
- **"Upcoming" is decided at build time.** The site works out which events are upcoming when it is rebuilt, not when someone visits. A past event stays listed until the next rebuild. *Managing Special Events* explains how to handle this.
- **If a partner service is down, only that feature is affected.** For example, if FareHarbor is down, booking fails but the rest of the site works.

# Where Everything Is Managed

Use this table to find where a piece of content is changed and who can change it.

- **Staff (CMS)**: edit it yourself at `/admin`. See the *Administrator Guide*.
- **Staff (FareHarbor / HighLevel)**: edit it in that service's own dashboard.
- **Developer**: the content is part of the site's code. Send a change request (see *Requesting Changes the CMS Can't Make*).

## Content on the website

| Content | Managed in | Who |
| --- | --- | --- |
| Site alert banner (on/off and message) | Content Manager → Alerts & Booking → Update the announcement banner | Staff (CMS) |
| Tour booking link and Guided Tour link | Content Manager → Alerts & Booking → Update tour booking links | Staff (CMS) |
| Special events | Content Manager → Special Events → Add or update events | Staff (CMS) |
| Event categories (filter buttons) | Content Manager → Special Events → Event Categories | Staff (CMS) |
| Staff directory and board list | Content Manager → Staff & Board → Update staff & board | Staff (CMS) |
| Corporate sponsor logos | Content Manager → Sponsors & Partners → Update sponsor recognition | Staff (CMS) |
| Tours, prices, availability, and checkout | FareHarbor dashboard | Staff (FareHarbor) |
| Donation form fields, receipts, and funds | HighLevel → Payments / Forms | Staff (HighLevel) |
| Membership checkout pages and renewals | HighLevel → Payments → Products / Payment Links / Subscriptions | Staff (HighLevel) |
| Follow-up emails and pipelines for inquiries | HighLevel → Automation / Opportunities | Staff (HighLevel) |
| Tour descriptions on the Visit page (names, durations, "From $…") | Code: `src/lib/tours.ts` | Developer |
| Hours, season, and tour times | Code: `src/app/visit/page.tsx` | Developer |
| Visit FAQ | Code: `src/lib/faq.ts` | Developer |
| Address, phone, email, EIN, social links | Code: `src/lib/site-config.ts` | Developer |
| Main menu and footer links | Code: `src/lib/site-config.ts` | Developer |
| Venues (names, capacities, photos) | Code: `src/lib/venues.ts` | Developer |
| Event types, inquiry form options, "What's included" | Code: `src/lib/host-content.ts` | Developer |
| Membership tier names, prices, benefits, and checkout links | Code: `src/lib/support-content.ts` | Developer |
| Donation "impact" examples | Code: `src/lib/support-content.ts` | Developer |
| Donation form link | Code: `src/components/support/DonateWidget.tsx` | Developer |
| History chapters, map hotspots, restoration timeline | Code: `src/lib/history.ts` | Developer |
| Architecture features and glossary | Code: `src/lib/fort-terminology.ts` | Developer |
| Explore the Fort videos and map markers | Code: `src/lib/explore-fort.ts`; videos in Cloudflare R2 | Developer |
| Mission, vision, report PDFs (About page) | Code: `src/app/about/page.tsx`; PDFs in Cloudflare R2 | Developer |
| Page headlines and body text | Code: `src/app/<page>/page.tsx` and `src/components/` | Developer |
| URL redirects from the old website | Code: `public/_redirects` | Developer |
| Form destinations (webhook URLs), HighLevel credentials | Cloudflare Pages → Settings → Variables | Developer |

<p class="callout info">Why isn't everything editable in the CMS? The editable areas were deliberately kept small so that staff can't accidentally break page layouts. Content that rarely changes lives in code, where changes are reviewed first.</p>

# Accounts and Services

The outside accounts the website depends on. Keep the ownership details current. If the only person with access to an account leaves, the Trust can lose control of part of the website.

<p class="callout warning">Record who holds the owner or admin login for each service below, and make sure at least two Trust staff members have access. Store passwords in the Trust's password manager, never in this book.</p>

| Service | Used for | Address | Owner / admin (fill in) |
| --- | --- | --- | --- |
| **GitHub** | Code and content repository `pmgasset/fortadamswebsite`. Content Manager sign-in. | github.com/pmgasset/fortadamswebsite | |
| **Cloudflare** (Pages) | Builds and hosts the website. Stores secret settings. | dash.cloudflare.com → Workers & Pages | |
| **Cloudflare** (R2) | Video and PDF storage behind `cdn.r2.fortadams.org` | dash.cloudflare.com → R2 | |
| **Cloudflare** (DNS) | Domain records for `fortadams.org` | dash.cloudflare.com → DNS | |
| **Decap OAuth proxy** | Lets the Content Manager sign in with GitHub | `decap-oauth.fortadams.org` | |
| **GitHub OAuth App** | The app the proxy uses for sign-in | GitHub → Settings → Developer settings → OAuth Apps | |
| **FareHarbor** | Tour catalogue, booking, payments | fareharbor.com (company `fortadamstrust`) | |
| **HighLevel** | CRM, donations, memberships, inquiry pipelines, automations | crm.fortadams.org | |
| **Domain registrar** | Registration of `fortadams.org` | | |

## Access for staff editors

To use the Content Manager, a staff member needs:

1. A personal **GitHub account**. It's free, and you sign up at github.com.
2. **Write access** to the `pmgasset/fortadamswebsite` repository, granted by a repository admin under **Settings → Collaborators** on GitHub.

Remove access promptly when someone leaves the Trust.

## Access for developers

A developer typically needs:

- Write access to the GitHub repository.
- Access to the Cloudflare Pages project to view builds and manage environment variables.
- Read access to HighLevel to check pipelines, custom field IDs, and webhooks.
- Optionally, access to Cloudflare R2 to upload media.

# Glossary

Terms used throughout this book. For the fortification terms (bastion, casemate, and so on), see the website's own Architecture & Terminology page.

| Term | Meaning |
| --- | --- |
| **/admin** | The address of the Content Manager, for example `https://www.fortadams.org/admin/`. |
| **Build** | The automatic process that turns the code and content into the finished website. It runs after every change and takes a few minutes. |
| **Cloudflare Pages** | The service that builds and hosts the website. |
| **Cloudflare R2** | Cloudflare's file storage, used for videos and PDFs (`cdn.r2.fortadams.org`). |
| **CMS / Content Manager / Decap** | The staff editing tool at `/admin`. Decap CMS is the name of the open-source software. |
| **Commit** | A saved change in GitHub. Every Content Manager save creates one. |
| **Deploy** | Publishing a finished build so that visitors see it. |
| **Environment variable** | A setting stored in Cloudflare rather than in the code, such as a secret key or a webhook address. |
| **FareHarbor** | The tour booking and ticketing service. |
| **Featured event** | The one event highlighted in a large band at the top of the Events page. |
| **GitHub** | The service that stores the website's code and content, with history. |
| **HighLevel / GHL / LeadConnector** | The Trust's CRM at `crm.fortadams.org`. The website sends inquiries there and links to its donation and membership checkouts. |
| **Inbound webhook** | An address in HighLevel that accepts form data and starts a workflow. |
| **Lightframe** | FareHarbor's pop-up booking window that opens over the website. |
| **Main branch** | The version of the code on GitHub that is live on the website. |
| **Opportunity** | A HighLevel deal record in a pipeline, such as an event inquiry. |
| **Pages Function** | A small piece of server code hosted by Cloudflare. The site has one: `/api/event-inquiry`. |
| **Payment link** | A HighLevel hosted checkout page. Each membership tier has one. |
| **Pipeline / stage** | HighLevel's way of tracking leads through steps, such as New Inquiry → Tour Booked → Contract. |
| **Placeholder** | Temporary content marked `[PLACEHOLDER: …]` in the code that still needs real content. |
| **Preview deployment** | A private test version of the site that Cloudflare builds for proposed changes before they go live. |
| **Repository (repo)** | The project's folder of code and content on GitHub. |
| **Static site** | A website made of pre-built pages rather than pages generated for each visitor. |
| **Subscription** | A HighLevel recurring billing record, such as an annual membership. |

# Administrator Guide

For Fort Adams Trust staff who update the website. Step-by-step instructions for the Content Manager (/admin), plus what happens with donations, memberships, and form submissions.

# Signing In to the Content Manager

The **Content Manager** is where staff update the parts of the website they're responsible for. It runs in your web browser, so there's nothing to install. It has two parts:

- The **Staff workspace** at `https://www.fortadams.org/admin/` is a start page with one card per task and built-in help. You don't need to sign in to view it.
- The **editor** at `https://www.fortadams.org/admin/edit/` is where you make and publish changes. You sign in here.

## Before your first sign-in

You need:

1. **A GitHub account.** Create one for free at github.com if you don't have one. Use your work email.
2. **Access to the website repository.** Ask the website administrator to add your GitHub username as a collaborator with write access on `pmgasset/fortadamswebsite`. GitHub will email you an invitation, which you must **accept** before you can sign in.

<p class="callout info">The Content Manager uses GitHub to sign in because GitHub is where the website's content is stored. Every change you save is recorded under your name, which makes it easy to see who changed what and to undo mistakes.</p>

## Signing in

1. Go to the Staff workspace at **`https://www.fortadams.org/admin/`**.
2. Click the card for what you want to do. The six tasks are: *Add or update an event*, *Update the alert banner*, *Update staff & board*, *Recognize our sponsors*, *Change a booking link*, and *Manage event categories*. To see every editing area, use **Open all editing areas** at the bottom of the page.
3. The editor opens and shows "Opening your editor" while it loads. Then click **Login with GitHub**.
4. A GitHub window opens. Allow pop-ups if your browser asks, sign in if asked, and click **Authorize** the first time.
5. The editor opens directly on the task you picked.

<p class="callout info">The Staff workspace also has a <strong>Help when you need it</strong> section with short answers on sign-in, saving events for later, event times, photos, and missing changes. It's a quick reminder of the fuller instructions in this book.</p>

## What you'll see in the editor

The editor's left-hand menu has four collections:

| Collection | Contains | Guide page |
| --- | --- | --- |
| **Special Events** | *Add or update events*, *Event Categories* | Managing Special Events; Managing Event Categories |
| **Alerts & Booking** | *Update the announcement banner*, *Update tour booking links* | Site Alert Banner; Tour Booking Links |
| **Staff & Board** | *Update staff & board*, which holds both lists | Staff and Board Directory |
| **Sponsors & Partners** | *Update sponsor recognition* | Corporate Sponsors |

Click a collection, then click the item inside it to open its form. Each item includes a short description of what it controls, and most fields have a hint underneath.

<p class="callout info">The Content Manager doesn't show a preview of the website design. To see how a change looks, open the live page a few minutes after publishing.</p>

<p class="callout warning"><strong>One editor at a time.</strong> Each item saves the <em>whole</em> list when you publish. For example, publishing the events list saves every event, not just the one you changed. If two people edit the same item at once, the last to publish can overwrite the other's changes. Let colleagues know before editing a shared list.</p>

## Signing out

Click your profile picture in the top-right corner of the Content Manager and choose **Log Out**. Always sign out on shared computers.

## If sign-in doesn't work

See *Admin Troubleshooting → I can't sign in*.

# How Your Changes Get Published

## What happens when you click Publish

1. **You click Publish.** Changes in the Content Manager are *not* saved until you do. If you close the tab first, your edits are lost.
2. **The change is saved to GitHub.** The Content Manager records it as a new version of the content file, under your name.
3. **Cloudflare starts rebuilding the website.** This happens automatically on every change.
4. **The new version goes live.** This usually takes **2–5 minutes** after you publish.

There's no separate "go live" step or approval queue. **Publishing makes the change public.**

<p class="callout warning">Because Publish goes straight to the live site, double-check dates, spelling, and links before you click it.</p>

## Checking that your change is live

- Wait a few minutes, then open the page on the public site and **refresh**. On Windows press `Ctrl` + `F5`; on Mac press `Cmd` + `Shift` + `R`. This forces a fresh copy.
- Still not showing after 10 minutes? A developer or anyone with Cloudflare access can check **Cloudflare dashboard → Workers & Pages → the website project → Deployments**. The newest deployment should say *Success*. If it says *Failed*, contact the developer. The live site keeps showing the last successful version, so a failed build never takes the site down.

## Making several changes

You can publish several changes one after another. Each one triggers its own rebuild, and the last one to finish includes everything. There's no need to wait between edits.

## Undoing a mistake

- **Simple mistakes:** open the item again, correct it, and publish again.
- **Deleted something by accident, or not sure what changed:** ask the developer. Every save is kept in GitHub's history, so any earlier version can be restored.

## Things that also trigger a rebuild

Code changes by a developer also rebuild the site. Any rebuild refreshes time-sensitive content: past events drop off the Events and Home pages, and the footer's copyright year updates.

# Site Alert Banner

The alert banner is a short, gold-coloured announcement bar across the top of **every page**. Use it for time-sensitive news: weather closures, the season opening, a special event, or a change in hours.

## Turning the banner on or changing the message

1. Sign in to the Content Manager.
2. Go to **Alerts & Booking → Update the announcement banner**.
3. Switch **Show the banner** on.
4. Type the **Message**. It can be at most **120 characters**.
5. Click **Publish**.

## Turning the banner off

1. Go to **Alerts & Booking → Update the announcement banner**.
2. Switch **Show the banner** off. You can leave the message text in place for next time.
3. Click **Publish**.

## How it behaves for visitors

- Visitors can close the banner with the **×** button. Their browser remembers this, so that visitor won't see the same message again.
- **If you change the message**, the banner reappears for everyone, including people who closed the old one. To re-announce something important, edit the wording slightly.
- The banner only shows when it's switched on **and** the message isn't blank.
- It can't contain links or formatting, only plain text.

## Writing tips

- Put the key fact first: "Closed Sat., Oct 12 for a private event — grounds remain open."
- Include the date so the message doesn't go stale.
- Remember to turn it off when it no longer applies. It doesn't expire on its own.

# Tour Booking Links

All tour booking happens in **FareHarbor**. The website only needs the web address (URL) of your FareHarbor booking flow. When a visitor clicks **Buy Tickets** or **Book now**, FareHarbor's booking window pops up over the website.

## What's managed where

| Managed in FareHarbor | Managed in the Content Manager |
| --- | --- |
| Tour products, descriptions, and photos | **FareHarbor booking link**: the default flow every *Book now* button opens |
| Prices, discounts, and availability | **Guided Tour booking link**: optional; lets the Guided Tour card open a specific tour |
| Checkout, payments, confirmations, cancellations | |

<p class="callout info">The tour descriptions on the Visit page (names, durations, "From $15 · Age 6+") are separate, fixed text written into the site. If you change prices or durations in FareHarbor, ask the developer to update those cards too. See <em>Requesting Changes the CMS Can't Make</em>.</p>

## Changing a booking link

1. In **FareHarbor**, use the **Book Buttons & Embeds** tool (under *Settings* in the FareHarbor dashboard) to generate a booking link for the flow or tour you want.
2. Copy **only the URL**. It starts with `https://fareharbor.com/embeds/book/`. Don't copy the HTML button code or any `<script>` code.
3. In the Content Manager, go to **Alerts & Booking → Update tour booking links**.
4. Paste the URL into the right field:
   - **FareHarbor booking link** (required) is used by the header's *Buy Tickets* button, the self-guided and group tour cards, and the *Book a Fort Adams tour* button at the bottom of the Visit page.
   - **Guided Tour booking link** (optional) is used only by the Guided Tour card. Leave it blank to use the default link.
5. Click **Publish**.

The current default link is:

```
https://fareharbor.com/embeds/book/fortadamstrust/?full-items=yes
```

## Validation

The Content Manager rejects anything that isn't a FareHarbor booking URL, and shows *"Enter a valid FareHarbor booking URL."* If you see this, check that you copied the full address, starting with `https://fareharbor.com/embeds/book/`, and nothing else.

## Testing after a change

After the site updates, open the Visit page and click each *Book now* button. The FareHarbor window should open over the page and show the right tours. If a button leads to a new page instead of a pop-up, or shows *Online booking opens soon*, the link isn't being recognised. Recheck it, or contact the developer.

# Managing Special Events

Special events appear on the **Events** page (list and calendar views) and in the **What's on** scroller on the Home page, which shows the next six events.

## Adding an event

1. Sign in to the Content Manager.
2. Go to **Special Events → Add or update events**.
3. Click **Add Event**. The new event appears at the top of the list.
4. Fill in the fields (see the table below).
5. Switch on **Show this event on the website**. **New events start hidden**, so the event won't appear on the site until you do this.
6. Click **Publish**.

The website always sorts events by start date, so there's no need (and no way) to reorder them in the editor.

## Event fields

| Field | Required? | Notes |
| --- | --- | --- |
| **Show this event on the website** | Yes | **Off by default for new events.** Switch it on when the details are complete. Off means saved but hidden from visitors. |
| **Feature this event** | Yes | Shows the event in a large *Featured event* band at the top of the Events page. **Feature only one upcoming event at a time.** If several are featured, only the soonest is highlighted. |
| **Event name** | Yes | Keep it short. It's the card title. |
| **Category** | Yes | Pick from the list. Categories power the filter buttons. Manage them under *Event Categories*. |
| **Start date and time** | Yes | Enter in **Eastern Time**, and check AM/PM. See the warning below. |
| **End date and time** | No | Must be later than the start. Leave blank if no end time is listed. For multi-day events, set the last day. The card then shows a date range. |
| **Location** | Yes | For example, "Fort Adams North Lawn". |
| **Description** | Yes | One or two sentences for the event card. Plain text only. |
| **Event image** | No | Upload or choose an image. If left blank, a branded placeholder image is shown. See *Working with Images*. |
| **Ticket or event website URL** | No | A full `https://` address with no spaces, for example an Eventbrite page or a partner's event page. The card shows a **Get tickets** button that opens it in a new tab. |
| **Link to a page on our website** | No | Only for a page on *this* website, entered as a path starting with `/`, for example `/visit/`. The card shows a **Book now** button. Use this **or** the ticket URL, not both; if both are filled in, the ticket URL wins. |

If an event has neither link, its card shows **Learn more**, which goes to the Events page.

<p class="callout warning"><strong>Time zones:</strong> the date picker uses your computer's time zone. Enter events from a computer set to Eastern Time. If you're travelling or your computer is set to another time zone, the event time will be wrong on the website.</p>

<p class="callout info"><strong>All-day events:</strong> if you set the start time to exactly 12:00 AM, the card shows just the date with no time.</p>

## Editing an event

Open **Add or update events**, click the event in the list (entries are labelled "*Event name — start date*"), make your change, and click **Publish**.

## Hiding an event without deleting it

Switch off **Show this event on the website** and publish. The event stays in the Content Manager so you can reuse it, for example for next year's edition.

## Deleting an event

Prefer hiding (above) if you might need the event again. To delete it permanently, use the event's delete control in the list, confirm, and click **Publish**. Deleted events can be recovered from GitHub history by a developer if needed.

## Featuring an event

1. Turn **off** *Feature this event* on the event currently featured.
2. Turn it **on** for the new one.
3. Publish.

The featured event appears in its own band above the monthly list and isn't repeated in the list. It shows only when it matches the selected category filter.

## When past events disappear

<p class="callout warning">Events disappear from the website the first time the site is <strong>rebuilt</strong> after the event ends, not at the moment it ends. The site is only rebuilt when someone publishes a change or a developer updates the code. After a quiet stretch with no changes, finished events can linger on the Home and Events pages.</p>

To clear out past events, publish any change, or ask someone with Cloudflare access to **retry the latest deployment**. There's no need to delete old events; they drop off automatically once the site rebuilds. A daily automatic rebuild is listed under *Known Issues and Open Items*.

## Good practice

- Add events well ahead, ideally at least a month before, so they show on the Home page.
- Use a real photo where possible. Placeholder art is fine as a stop-gap.
- For partner events (for example, Audrain Cars & Coffee), link to the organiser's page in the ticket URL and keep the description general, such as "See the organizer for the latest event details."
- Check the Events page in both **List** and **Calendar** views after publishing.

# Managing Event Categories

Event categories are the filter buttons on the Events page (for example *Music*, *Family*, *Community*) and the choices in each event's **Category** field.

Current categories: Music · Tours · Family · Seasonal · Community · Fundraising · Sports & Recreation.

## Adding a category

1. Go to **Special Events → Event Categories**.
2. Click **Add Category** and type a **Name**. Don't put spaces at the start or end.
3. Drag categories to set the order of the filter buttons.
4. Click **Publish**.

## Renaming or removing a category

<p class="callout warning">Events store the category <em>name</em> as text. Renaming or removing a category does <strong>not</strong> update events that already use it. Those events still appear under <em>All events</em>, but no filter button will match them.</p>

To rename safely:

1. Add the new category name and publish.
2. Open **Add or update events** and change every event that used the old name to the new one. Publish.
3. Remove the old category and publish.

To remove a category, first move its events to another category, then delete it.

## Tips

- Keep the list short. Every category becomes a button, and on phones they scroll sideways.
- Each name must be unique.
- A category with no upcoming events still shows as a button. Clicking it shows "No events in this category right now".

# Staff and Board Directory

The **About** page lists staff (with photo and contact details) and the board of directors (names and roles). Both are edited in one place.

## Opening the directory

Go to **Staff & Board → Update staff & board**. The form has two lists:

- **Staff members**, shown as cards, each with a photo.
- **Board members**, shown as a simple list of names.

The order in the editor is the order on the website. **Drag entries to reorder them.**

## Staff member fields

| Field | Required? | Notes |
| --- | --- | --- |
| **Name** | Yes | |
| **Title** | Yes | For example, "Executive Director". |
| **Photo** | No | Shown as a **square**, cropped from the centre. If blank, a placeholder image shows. See *Working with Images*. |
| **Bio** | No | A short paragraph. Plain text. |
| **Email** | No | Must be a valid address, such as `name@fortadams.org`. **Shown publicly** as a clickable email link. |
| **Phone** | No | Any format, such as `(401) 841-0707`. **Shown publicly**; becomes a tap-to-call link on phones. |

## Board member fields

| Field | Required? | Notes |
| --- | --- | --- |
| **Name** | Yes | |
| **Role** | No | For example "President" or "Treasurer". Leave blank for general members. |

## Common tasks

- **New staff member:** click **Add Staff member**, fill in the fields, drag the entry into place, and publish.
- **Someone leaves:** delete their entry and publish. Also remove their GitHub access if they could use the Content Manager (see *Accounts and Services*).
- **New board year:** update roles, add and remove members, reorder so officers are listed first, and publish.

<p class="callout info">If either list is empty, the About page shows "Staff details coming soon" or "Board details coming soon" instead of an empty section.</p>

# Corporate Sponsors

The **Support Us** page recognises annual corporate sponsors and partners with a logo wall, under the *Corporate Giving* tab.

## Opening the sponsor list

Go to **Sponsors & Partners → Update sponsor recognition**.

## Section fields

| Field | Notes |
| --- | --- |
| **Recognition year** | A four-digit year. Shown above the heading as "*2026* recognition". |
| **Section heading** | For example, "Annual Corporate Sponsors & Partners". |
| **Introductory text** | A short thank-you paragraph under the heading. |

## Sponsor fields

| Field | Required? | Notes |
| --- | --- | --- |
| **Show this sponsor on the website** | Yes | Turn off to hide a sponsor without deleting it. |
| **Organization name** | Yes | Used as the logo's alt text for screen readers. |
| **Logo** | Yes | Upload the logo image. See the tips below. |
| **Website URL** | No | A full `https://` address. If set, the logo becomes a link. |

New sponsors are added at the top. **Drag entries to set the display order.**

## Starting a new sponsorship year

1. Update **Recognition year** and, if needed, the heading and intro.
2. Hide or delete sponsors who didn't renew.
3. Add new sponsors and reorder the list.
4. Publish.

## Logo tips

- Use a **PNG with a transparent background** where available. JPG is fine for logos with a solid white background.
- About **600 px wide** is plenty. Very large files (over 1 MB) slow the page down, so ask the sponsor for a web version.
- Use a horizontal (landscape) logo where possible. Tall logos appear small.

# Working with Images

You can upload images for **events**, **staff photos**, and **sponsor logos**. Every uploaded image is stored permanently with the website's code, so keeping images small keeps the site fast.

## Where uploads go

| Uploaded from | Stored in | Used on |
| --- | --- | --- |
| Special Events → Event image | `public/images/events/` | Event cards (Home and Events pages) |
| Staff & Board → Photo | `public/images/staff/` | About page staff cards |
| Sponsors & Partners → Logo | `public/images/sponsors/` | Support Us sponsor wall |

When you click an image field, you can **upload** a new file or **choose** one already uploaded to that folder. Reusing an existing image is fine.

## Size and format guidelines

| Use | Recommended size | Format | Aim for under |
| --- | --- | --- | --- |
| Event image | 1200 × 800 px (landscape, 3:2) | JPG or WebP | 300 KB |
| Staff photo | 800 × 800 px (square; face centred) | JPG or WebP | 200 KB |
| Sponsor logo | about 600 px wide | PNG (transparent) or JPG | 150 KB |

<p class="callout warning">Photos straight from a phone or camera are often 3–10 MB. Resize them before uploading, using a free tool such as squoosh.app or your computer's built-in photo editor. Large files slow the site for every visitor and bloat the repository permanently.</p>

## File names

Use short, descriptive, lowercase names with hyphens, such as `harvest-concert-2026.jpg` or `jane-smith.jpg`. Avoid spaces and special characters.

## Photo rights

Only upload photos the Trust has permission to use. For event photos supplied by partners, confirm the partner is happy for the Trust to use them.

## Other images on the site

Hero photos, venue photos, history images, the fort map, and Explore the Fort videos are part of the site's code or stored in Cloudflare R2. Ask the developer to change these (see *Requesting Changes the CMS Can't Make*).

# Donations and Memberships

The website doesn't process payments itself. Donations and memberships are handled on **HighLevel** hosted pages at `crm.fortadams.org`. The website's job is to send supporters to the right page.

## Donations

**On the website:** Support Us → *Donate* shows a **Make your gift** box with a **Continue to secure donation form** button. It also mentions the *Keeper of the Fort* recognition for gifts of $25 per month.

**Where the button goes:** the HighLevel **Web Donation** form:

```
https://crm.fortadams.org/widget/form/okXo0SaqzMNahWJzB1YZ
```

The donor enters the amount, their details, and payment on that form. The website doesn't pre-fill the amount or frequency.

**Where to manage it:** in HighLevel, under the form and payments settings: form fields, receipts, thank-you emails, and follow-up workflows.

<p class="callout warning"><strong>HighLevel setup to confirm.</strong> As of September 2026, these donation settings in HighLevel still need to be configured and tested (this is HighLevel setup, not website code):</p>

- Email is required, and donors are matched to existing contacts by email without overwriting membership status or tags.
- Fund/designation and campaign choices are captured per gift. The form checked on September 23, 2026 didn't show these fields.
- A successful-payment workflow links each transaction to the contact, records its classification, adds tags, and sends a receipt.
- Handling of duplicate transactions, failed payments, refunds, and, if offered, recurring gifts.
- End-to-end test gifts: a new donor, an existing member, repeat gifts to different funds, a failed payment, and a refund. Check the amount and history on the contact record. Opening the form or submitting it once doesn't prove the setup works.

### Donor-advised fund (DAF) gifts

Below the donation box, a panel tells donors how to give from a donor-advised fund. It shows the Trust's legal name, EIN (**05-0475756**), and mailing address. If the Trust signs up for a DAF giving widget (for example Chariot/DAFpay), a developer can switch this panel to show the widget instead.

## Memberships

**On the website:** Support Us → *Membership* shows four annual tiers, each with a **Join as …** button:

| Tier | Price | Benefits shown on site |
| --- | --- | --- |
| Individual | $50 / year | Membership benefits for 1 adult |
| Family | $75 / year | 2 adults and children/grandchildren up to 18 |
| Patron | $500 / year | Standard benefits + 5 guest passes; $450 tax-deductible |
| Benefactor | $1,000 / year | Standard benefits + 10 guest passes; $950 tax-deductible |

The Visit page also advertises that **members tour for free**, with a link to this section.

**Where the buttons go:** each tier links to its own HighLevel **payment link** (`https://crm.fortadams.org/payment-link/…`) for a **recurring product**. When someone pays:

1. HighLevel creates or updates their **contact**.
2. HighLevel creates an annual **subscription** automatically. Nothing else needs to create one.
3. The subscription renews every year until cancelled. The site says "Renews annually. Cancel anytime."

**Where to manage it:** HighLevel → **Payments → Subscriptions** for active members, renewals, and cancellations; **Payments → Products** for the recurring products; and **Automation** for onboarding workflows. Set workflows to trigger on the subscription, filtered by product and *Active* status.

<p class="callout warning">If you change a tier's price or benefits in HighLevel, the website <strong>won't</strong> update automatically. Tier names, prices, benefits, and checkout links are written into the site. Ask the developer to update them at the same time, so the site never advertises a different price from the checkout.</p>

<p class="callout info">Only the four tiers above have website checkout links. Other levels, such as legacy levels carried over from the previous CRM, must be handled directly in HighLevel. While members are moving from the old CRM, make sure no one is billed by both systems for the same renewal.</p>

# Website Forms and Where Submissions Go

The website has four forms. All submissions go to **HighLevel** (crm.fortadams.org). None are emailed directly, so set up HighLevel workflows to notify the right staff.

## Summary

| Form | Page | Goes to | Tags added | Source label |
| --- | --- | --- | --- | --- |
| **Event inquiry** | Host an Event → *Inquire* | Contact + Opportunity in the **events pipeline** | `Event Inquiry`, `Website` | `Website — Event Inquiry` |
| **Volunteer** | Support Us → *Volunteer* | Volunteer inbound webhook | `Volunteer`, `Website` | `Website — Volunteer` |
| **Corporate giving** | Support Us → *Corporate giving* | Corporate inbound webhook | `Corporate Giving`, `Website` | `Website — Corporate Giving` |
| **Newsletter sign-up** | Events → *Stay in the loop* | Newsletter inbound webhook | `Newsletter`, `Website` | `Website — Events Newsletter` |

## Event inquiries

**Fields collected:** first and last name, email, and event type (all required); phone, organisation, preferred date, estimated guests, estimated budget, and message (optional).

**What HighLevel receives:**

- A **contact** is created, or updated if the email already exists, with the tags and source above.
- An **opportunity** named like *Event Inquiry — Jane Smith (Weddings)* is created in the events pipeline at the configured starting stage, with status *Open*.
- The opportunity's **value** is estimated from the budget answer: Under $5,000 → $3,000; $5,000–$10,000 → $7,500; $10,000–$25,000 → $17,500; $25,000+ → $30,000; Not sure yet → $0.
- If the developer has set them up, the event type, guest count, budget, date, and message are also saved in opportunity **custom fields**.

**What the visitor sees:** "We've received your inquiry and will get back to you very soon — typically within one business day." This appears **only** after HighLevel has confirmed both records were created. If anything fails, the visitor sees an error message with the Trust's email address instead.

**What staff should set up in HighLevel:** a workflow triggered by the `Event Inquiry` tag, or by new opportunities in the events pipeline, that notifies the events team and sends an acknowledgement email. The site promises a reply **within one business day**.

## Volunteer, corporate giving, and newsletter forms

These three forms send their data to HighLevel **inbound webhooks**, one per form, so each can start its own workflow and pipeline. Each submission includes the person's name, email, phone (if given), their answers, the source and tags above, a suggested opportunity name (such as *Volunteer — Jane Smith*), and the time submitted.

The volunteer form asks for an **area of interest**: Tours & guiding · Events · Restoration & grounds · Administrative · Wherever I'm needed. The corporate form asks for an **organisation** and a **partnership interest**: Event sponsorship · Corporate membership · In-kind / vendor partnership · Employee volunteering · Something else.

<p class="callout danger"><strong>Important.</strong> These three forms can't confirm delivery, so they always show a thank-you message. If a webhook address isn't configured, or HighLevel rejects the data, the visitor still sees "Thank you!" but the submission is lost. After any change to HighLevel webhooks or workflows, submit a test through each form and confirm it arrives in HighLevel. See <em>Known Issues and Open Items</em>.</p>

## Testing the forms

Every few months, and after any HighLevel change:

1. Submit each form with a clearly marked test name, such as "TEST — Please delete".
2. Confirm the contact, tags, and (for event inquiries) the opportunity appear in HighLevel.
3. Confirm the staff notification arrived.
4. Delete the test records.

## Spam

The forms don't have a CAPTCHA. If spam becomes a problem, tell the developer. Filters can be added in HighLevel workflows, or spam protection added to the site.

# Requesting Changes the CMS Can't Make

Much of the website's text is written into its code and can't be edited in the Content Manager. *Where Everything Is Managed* has the full list. The most common requests are:

- Opening hours, season dates, or tour times (Visit page)
- Tour descriptions, durations, or "From $…" prices (Visit page)
- FAQ questions and answers
- Membership prices, benefits, or checkout links
- The donation form link
- Phone number, email, address, or social media links
- Venue details or photos (Host an Event page)
- History chapters, the restoration timeline, or glossary terms
- Hero photos, page headlines, or body text
- New pages, menu changes, or redirects from old web addresses
- Adding a new editable area to the Content Manager

## How to request a change

Send the developer a request that includes:

1. **Page and section.** Include the page address and the heading nearby, for example "Visit page → Hours & season → Off-peak tour times".
2. **Current text.** Copy and paste it.
3. **New text.** Paste the exact replacement, already proofread.
4. **Deadline.** Say whether it has to be live by a certain date and time.
5. **Images or files.** Attach them at full quality. The developer will resize them.

A screenshot with the area circled is always helpful.

## Typical turnaround

Simple text changes can usually go live the same day once the developer has made them. Every developer change goes through the same automatic rebuild as your Content Manager edits.

## Keep the systems in step

Some content exists both on the website and in another system. When you change one, request the matching change to the other:

| If you change… | Also update… |
| --- | --- |
| Tour prices or durations in FareHarbor | The tour cards on the Visit page |
| Membership prices or benefits in HighLevel | The membership tiers on Support Us |
| A membership payment link in HighLevel | The tier's checkout link in the site code |
| Hours or season | The Visit page, the Home quick-facts strip, and the FAQ |
| Phone or email | The site configuration (footer, forms' error messages, DAF panel) |

# Admin Troubleshooting

## I can't sign in

- **The editor is stuck on "Opening your editor", or says "We couldn't load the editor".** Check your internet connection and reload the page. Work or school networks sometimes block the editor's software, so try another network. If it keeps happening, contact the developer.
- **"Login with GitHub" does nothing.** Your browser may be blocking the sign-in pop-up. Allow pop-ups for fortadams.org and try again.
- **"Login with GitHub" shows an error page.** The sign-in service may be down or misconfigured. Contact the developer. They can check the OAuth proxy at `decap-oauth.fortadams.org`.
- **You sign in to GitHub but the Content Manager says you don't have access.** Check that a repository admin has added your GitHub username and that you **accepted** the emailed invitation. Invitations expire after 7 days.
- **Signed in to the wrong GitHub account.** Log out of github.com, then try again.

## My change isn't showing on the website

1. Did you click **Publish**? Saving a draft or closing the tab doesn't publish.
2. **New event not showing?** New events start hidden. Open it and check **Show this event on the website** is switched on. Also check the end date hasn't already passed.
3. Wait **5 minutes**, then hard-refresh the page (`Ctrl` + `F5` on Windows, `Cmd` + `Shift` + `R` on Mac).
4. Try a private/incognito window to rule out your browser's saved copy.
5. Still missing after 10 minutes? The build may have failed. Contact the developer, or check **Cloudflare → Workers & Pages → project → Deployments** if you have access.

## An event that already happened is still showing

The site removes finished events only when it's rebuilt. Publish any change, or ask for the latest deployment to be retried. See *Managing Special Events → When past events disappear*.

## An event shows the wrong time

Check that the computer used to enter it was set to **Eastern Time**. Open the event, re-enter the start and end times from an Eastern Time computer, and publish.

## An event doesn't appear under a category filter

The event's category probably doesn't exactly match any name in **Event Categories**, for example after a category was renamed. Open the event, pick the category again from the list, and publish.

## The alert banner isn't showing for me

You may have closed it earlier. Your browser remembers that for the same message. Check in a private/incognito window. Also confirm **Show the banner** is on and the message isn't blank.

## "Book now" says "Online booking opens soon"

The FareHarbor link is missing or not recognised. Recheck **Alerts & Booking → Update tour booking links** (see *Tour Booking Links*).

## A "Join" button says "Online membership opens soon"

That tier's checkout link is missing or invalid in the site code. Contact the developer.

## A photo looks blurry, stretched, or badly cropped

- Staff photos are cropped to a square from the centre. Upload a square photo with the face centred.
- Use images at least as large as those recommended in *Working with Images*.

## The Content Manager shows an error when publishing

Copy the exact error message, take a screenshot, and send both to the developer. Don't keep retrying. Another person may have edited the same item at the same time; reload the page and redo your change.

## Who to contact

| Problem | Contact |
| --- | --- |
| Website content, Content Manager, broken pages | Website developer |
| Tours, bookings, refunds | FareHarbor dashboard / FareHarbor support |
| Donations, memberships, CRM records, automations | HighLevel administrator |
| Domain, hosting, or the site is down entirely | Website developer (Cloudflare) |

# Developer Guide

For developers maintaining the codebase: architecture, local setup, the content and data layer, components, integrations, the CMS configuration, and deployment.

# Architecture Overview

## Stack

| Concern | Choice |
| --- | --- |
| Framework | **Next.js 16.2** (App Router), **React 19.2**, **TypeScript 5** (strict) |
| Styling | **Tailwind CSS v4**, with CSS-first `@theme` tokens in `src/app/globals.css` and no `tailwind.config.js` |
| Rendering | **Static export** (`output: "export"`, `trailingSlash: true`) → plain HTML/CSS/JS in `out/` |
| Hosting | **Cloudflare Pages**, Git-integrated; every push to `main` deploys |
| Server code | One **Cloudflare Pages Function**: `functions/api/event-inquiry.ts` |
| CMS | **Decap CMS 3.x** at `/admin`, GitHub backend, commits JSON to `content/` |
| Media | `public/` for committed images; **Cloudflare R2** (`cdn.r2.fortadams.org`) for video and PDFs |
| Tours | **FareHarbor** Auto-Lightframe (script plus booking URLs; no API) |
| CRM / payments | **HighLevel** (LeadConnector API, inbound webhooks, hosted payment links and forms) |
| Tooling | ESLint 9 (`eslint-config-next`), Prettier 3 with `prettier-plugin-tailwindcss` |

<p class="callout warning"><strong>Next.js 16 differs from older versions.</strong> The repo's <code>AGENTS.md</code> warns that APIs, conventions, and file structure may differ from what you know. Read the bundled docs in <code>node_modules/next/dist/docs/</code> before using an unfamiliar API, and heed deprecation notices.</p>

## Request flow

```
Browser ──GET──▶ Cloudflare Pages CDN ──▶ out/**/index.html + /_next/static/*
   │
   ├─ POST /api/event-inquiry ──▶ Pages Function ──▶ HighLevel API
   │                                  (contacts/upsert, opportunities)
   ├─ POST (no-cors) ─────────────▶ HighLevel inbound webhooks
   │                                  (volunteer, corporate, newsletter)
   ├─ fareharbor.com/embeds/api/v1/?autolightframe=yes  (booking overlay)
   ├─ cdn.r2.fortadams.org/video/*.mp4, /documents/*.pdf
   └─ links out to crm.fortadams.org (donation form, membership payment links)
```

## Key design decisions

**Static export, no Node server.** Hosting is effectively free, fast, and has very little attack surface. Consequences:

- No Next.js image optimisation server. A custom loader (`src/lib/image-loader.ts`) passes URLs through, or routes them via Cloudflare Image Resizing when `NEXT_PUBLIC_CF_IMAGE_BASE` is set.
- No route handlers, server actions, ISR, or middleware. Dynamic behaviour is client-side, or lives in `functions/`.
- **Anything time-based is evaluated at build time.** For example, `getUpcomingEvents()` compares against `Date.now()` during the build, and the footer year comes from the build. Content only "ages" when the site rebuilds.
- `process.env.NEXT_PUBLIC_*` values are **inlined at build time** and are public. Changing them requires a rebuild.
- `sitemap.ts` and `robots.ts` use `export const dynamic = "force-static"`.

**Content in Git.** CMS-editable data is JSON in `content/`, imported statically by loaders in `src/lib/`. Everything else is typed TypeScript data in `src/lib/*.ts`. There's no database. Git history is the audit log and the backup.

**Constrained CMS.** Decap only edits a few JSON files with validated fields. Page layout and copy stay in code, so editors can't break the design.

**Third parties own their domains.** FareHarbor owns tours, pricing, and checkout. HighLevel owns contacts, payments, and subscriptions. The site holds URLs, not product data. Integrations are isolated in a few files so a provider can be swapped locally (see *HighLevel Integrations* and *FareHarbor Integration*).

**One server-side secret path.** The event inquiry needs a real success/failure response and a private API token, so it runs as a Pages Function. The other lead forms use fire-and-forget webhooks from the browser.

# Local Development Setup

## Prerequisites

- **Node.js 20 or newer.** The project has been run on Node 24.
- npm (bundled with Node)
- Git, with access to `github.com/pmgasset/fortadamswebsite`

## First run

```bash
git clone https://github.com/pmgasset/fortadamswebsite.git
cd fortadamswebsite
npm install
cp .env.example .env.local     # fill in what you need (see below)
npm run dev                    # http://localhost:3000
```

`.env*` files are git-ignored except `.env.example`. Never commit real secrets.

## Scripts

| Command | Purpose |
| --- | --- |
| `npm run dev` | Dev server with hot reload |
| `npm run build` | Production static export to `out/`. Run this before pushing; it catches type errors and export-incompatible code. |
| `npm run start` | Not useful with `output: "export"`. Serve `out/` with any static server instead, for example `npx serve out`. |
| `npm run lint` | ESLint |
| `npm run format` | Prettier (writes), including Tailwind class sorting |
| `npm run format:check` | Prettier check (CI-friendly) |

## Environment for local development

Most features work with an empty `.env.local`:

- **Webhook forms** (volunteer, corporate, newsletter) detect placeholder or empty URLs (anything without `http(s)://`, or containing `example.com`). Instead of sending, they simulate success after 500 ms. That's safe locally, but see *Known Issues and Open Items* for production.
- **Explore the Fort** videos default to `https://cdn.r2.fortadams.org`.
- **FareHarbor** reads its URL from `content/tour-booking.json`, so no environment variable is needed.

## Testing the event inquiry function locally

`next dev` doesn't run Cloudflare Pages Functions, so `POST /api/event-inquiry` returns 404 and the form shows its error state. To test end to end, build and run with Wrangler:

```bash
npm run build
npx wrangler pages dev out
```

Wrangler reads the `GHL_*` secrets from a `.dev.vars` file in the project root. The existing `.env*` ignore rule does **not** cover `.dev.vars`, so add `.dev.vars` to `.gitignore` before creating it. Use a HighLevel **test** pipeline or sub-account, because this creates real contacts and opportunities.

## Editing CMS content locally

`public/admin/config.yml` has `local_backend: true`, so you can use the CMS without GitHub auth:

```bash
npm run dev            # terminal 1
npx decap-server       # terminal 2 (proxy on port 8081)
```

Then open `http://localhost:3000/admin/edit/` (or start from the workspace at `/admin/`). Changes are written straight to your working copy. Review them with `git diff` and commit as usual.

## Before you push

```bash
npm run lint && npm run format:check && npm run build
```

There's no CI in the repository (no `.github/workflows`). Cloudflare Pages is the only automated build, so a broken build only shows up there. Run the build locally.

# Repository Structure

```
fortadamswebsite/
├── AGENTS.md / CLAUDE.md      # AI-assistant notes (Next 16 warning)
├── README.md                  # Project readme (partly outdated — this book is current)
├── .env.example               # All env vars, documented
├── next.config.ts             # output: export, trailingSlash, custom image loader
├── eslint.config.mjs          # next core-web-vitals + typescript; `_`-prefixed unused vars allowed
├── .prettierrc.json           # 100 cols, double quotes, trailing commas, Tailwind plugin
├── postcss.config.mjs         # @tailwindcss/postcss
├── tsconfig.json              # strict; alias @/* → src/*
│
├── content/                   # ◀ CMS-editable JSON (Decap writes here)
│   ├── alert.json             #   site alert banner
│   ├── tour-booking.json      #   FareHarbor default + guided URLs
│   ├── events.json            #   special events
│   ├── event-categories.json  #   event filter categories
│   ├── staff.json             #   staff members + board
│   └── sponsors.json          #   annual corporate sponsors
│
├── functions/
│   └── api/event-inquiry.ts   # ◀ Cloudflare Pages Function → HighLevel API
│
├── public/
│   ├── _redirects             # Cloudflare Pages redirects (old WordPress URLs)
│   ├── admin/
│   │   ├── index.html         # Staff workspace (task dashboard + help)
│   │   ├── workspace.css/.js  # workspace styles; old-bookmark redirect
│   │   ├── edit/index.html    # Decap editor shell (/admin/edit/)
│   │   ├── editor-loader.js   # loads pinned decap-cms@3.8.4 from unpkg
│   │   └── config.yml         # CMS collections & fields
│   └── images/
│       ├── events/ staff/ sponsors/   # CMS upload folders
│       ├── venues/ visit/ home/ history/ explore/ logo/ layout/
│       └── placeholders/      # branded fallbacks (fort-fallback.svg, etc.)
│
├── docs/bookstack/            # This book (Markdown sources + ZIP builder)
│
└── src/
    ├── app/                   # App Router routes
    │   ├── layout.tsx         # root layout: fonts, metadata, alert, header, footer, FareHarbor script
    │   ├── globals.css        # Tailwind import + @theme design tokens + base styles
    │   ├── page.tsx           # /
    │   ├── visit/ events/ history/ host-an-event/ support-us/ about/
    │   ├── architecture-and-terminology/
    │   ├── sitemap.ts         # /sitemap.xml
    │   └── robots.ts          # /robots.txt
    ├── components/
    │   ├── layout/            # Header, Footer, AlertBanner, Logo, PageHero
    │   ├── ui/                # Button, Card, Badge, Tag, FilterPill, Accordion, StickyTabNav,
    │   │                      #   Breadcrumb, Container, FortImage
    │   ├── home/              # HomeHero, QuickInfoStrip, ExploreFort, UpcomingEvents,
    │   │                      #   AudienceRouter, VenueTeaser, FortressStory
    │   ├── visit/             # TourCard, FareharborWidget (+ FareharborScript)
    │   ├── events/            # EventsExplorer, EventsCalendar, EventCard, FeaturedEventCard,
    │   │                      #   EventsSidebar, EmailSignup
    │   ├── history/           # HistoryExperience, RestorationTimeline
    │   ├── host/              # VenueCard, EventInquiryForm
    │   └── support/           # DonateWidget, DafPanel, MembershipTiers, LeadForm, SponsorGrid
    └── lib/                   # Data + loaders (no React)
        ├── site-config.ts     # org info, nav, CTAs, footer links
        ├── content.ts         # alert + tour-booking loaders, FareHarbor URL validation
        ├── events.ts          # events loader, sorting, grouping, date formatting
        ├── event-calendar.ts  # calendar-grid helpers (Eastern Time)
        ├── staff.ts sponsors.ts
        ├── tours.ts faq.ts venues.ts host-content.ts support-content.ts
        ├── history.ts         # chapters, map hotspots, restoration projects
        ├── fort-terminology.ts
        ├── explore-fort.ts    # six Explore the Fort videos (build-time validated)
        └── image-loader.ts    # next/image custom loader
```

## Git conventions

- `main` is production. Every push deploys.
- Decap commits directly to `main`, so CMS-authored commits appear in history alongside code commits. Pull before you start work to avoid conflicts in `content/`.
- `.gitattributes` normalises line endings to LF and marks images as binary.

# Routes and Pages

All routes are statically exported with trailing slashes (`/visit/` → `out/visit/index.html`). Each page exports `metadata` with `title`, `description`, and `alternates.canonical`. The root layout applies the title template `%s · Fort Adams Trust`.

| Route | File | Data sources | Notes |
| --- | --- | --- | --- |
| `/` | `src/app/page.tsx` | `getUpcomingEvents(6)`, `explore-fort.ts` | Sections: HomeHero → QuickInfoStrip → ExploreFort (`#explore-the-fort`) → UpcomingEvents → AudienceRouter → VenueTeaser → FortressStory. UpcomingEvents renders nothing when there are no events. |
| `/visit/` | `src/app/visit/page.tsx` | `tours.ts`, `faq.ts`, `getTourBooking()`, `site-config` | StickyTabNav anchors: `#tours`, `#hours`, `#getting-here`, `#faq`. **Hours and tour times are hard-coded in this file.** The Google Maps embed uses a place `cid`. The Guided card uses `guidedBookingUrl`; other cards use `bookingUrl`. |
| `/events/` | `src/app/events/page.tsx` | `getUpcomingEvents()`, `getFeaturedEvent()` | `EventsExplorer` (client) handles the list/calendar toggle and category filter. The calendar's initial month is the build month. |
| `/history/` | `src/app/history/page.tsx` | `history.ts` | `HistoryExperience` (chapters ↔ map hotspots, mobile Story/Map toggle), `#the-trust`, `#restoration-projects` (`RestorationTimeline`). |
| `/architecture-and-terminology/` | `src/app/architecture-and-terminology/page.tsx` | `fort-terminology.ts` | Glossary grouped by first letter, with a `#terms-X` index. |
| `/host-an-event/` | `src/app/host-an-event/page.tsx` | `venues.ts`, `host-content.ts` | Anchors: `#venues`, `#whats-included`, `#inquire`. `EventInquiryForm` posts to `/api/event-inquiry`. |
| `/support-us/` | `src/app/support-us/page.tsx` | `support-content.ts`, `getSponsorDirectory()`, env webhooks | Anchors: `#donate`, `#membership`, `#corporate` (sponsors), `#volunteer`. |
| `/about/` | `src/app/about/page.tsx` | `getStaff()`, `getBoard()` | Mission and vision copy and report PDF links (R2) are hard-coded here. |
| `/admin/` | `public/admin/index.html` | | Staff workspace (static task dashboard and help). `noindex`, disallowed in robots. |
| `/admin/edit/` | `public/admin/edit/index.html` | `public/admin/config.yml` | Decap editor, loaded by `editor-loader.js`. |
| `/sitemap.xml` | `src/app/sitemap.ts` | route list in file | **Update the `routes` array when adding a page.** |
| `/robots.txt` | `src/app/robots.ts` | | Disallows `/admin`. |
| `POST /api/event-inquiry` | `functions/api/event-inquiry.ts` | Pages secrets | See *HighLevel Integrations*. |

## Navigation

`src/lib/site-config.ts` defines:

- `primaryNav`: header links. They collapse to a hamburger menu below the `lg` breakpoint.
- `cta.buyTickets` (`/visit/#tours`) and `cta.donate` (`/support-us/#donate`): always visible. When a valid FareHarbor URL exists, the header's Buy Tickets becomes a direct FareHarbor link and opens the Lightframe.
- `footerLinks.explore | connect | legal`

<p class="callout danger"><code>footerLinks.legal</code> links to <code>/privacy</code>, but no <code>src/app/privacy/page.tsx</code> exists, so that link returns a 404. See <em>Known Issues and Open Items</em>.</p>

## Adding a page

See *Common Development Tasks → Add a new page*.

# Content and Data Layer

The site has two kinds of data. Both are read **at build time** only.

| Kind | Location | Edited by | Loaded via |
| --- | --- | --- | --- |
| **CMS content** | `content/*.json` | Staff via Decap, or developers | Static JSON imports in `src/lib/*` loaders |
| **Structured code content** | `src/lib/*.ts` exports | Developers | Direct imports |

## CMS content files

| File | Shape | Loader | Consumers |
| --- | --- | --- | --- |
| `content/alert.json` | `{ enabled: boolean, message: string }` | `getSiteAlert()` in `content.ts`, which returns `enabled` only if the trimmed message is non-empty | `AlertBanner` (root layout) |
| `content/tour-booking.json` | `{ bookingUrl: string, guidedBookingUrl: string }` | `getTourBooking()`. Both are validated with `isFareharborBookingUrl()` (https, host `fareharbor.com`, path starts `/embeds/book/`). An invalid default becomes `""`; an invalid or empty guided URL falls back to the default. | Header, Visit page, root layout (loads the script only if a URL exists) |
| `content/events.json` | `{ events: StoredFortEvent[] }` | `getPublicEvents()`, `getUpcomingEvents(limit?)`, `getFeaturedEvent()` | Home, Events |
| `content/event-categories.json` | `{ categories: { name }[] }` | `EVENT_CATEGORIES` (trimmed, deduped, order preserved) | Events filters |
| `content/staff.json` | `{ members: StaffMember[], board: BoardMember[] }` | `getStaff()`, `getBoard()` | About |
| `content/sponsors.json` | `{ year, heading, intro, sponsors: CorporateSponsor[] }` | `getSponsorDirectory()` (drops `isPublished === false`) | Support Us |

<p class="callout warning">Loaders use type assertions, not runtime schema validation. Decap enforces field rules in the editor, but hand-edited JSON isn't checked. Run <code>npm run build</code> after editing <code>content/</code> by hand.</p>

## The events pipeline

```ts
interface FortEvent {
  id: string;            // optional in JSON; generated if missing
  title: string;
  description: string;
  startDate: string;     // ISO 8601 with offset, e.g. "2026-10-03T09:30:00-04:00"
  endDate: string;       // "" allowed → treated as startDate
  location: string;
  imageUrl: string;      // "" → FortImage fallback
  isPublished?: boolean; // omitted = visible
  isFeatured: boolean;
  category: string;
  externalUrl?: string;  // → "Get tickets" (new tab); takes precedence
  bookingUrl?: string;   // site path → "Book now"
}
```

`getPublicEvents()` filters out `isPublished === false`, fills in missing IDs (`slug(startDate + "-" + title)`, since Decap's `id` field is hidden and never set for new entries), and sorts by `startDate`.

`getUpcomingEvents()` keeps events whose `endDate || startDate` is at or after **`Date.now()` at build time**. `getFeaturedEvent()` returns the first upcoming event with `isFeatured`.

**Time zone handling.** Display helpers (`monthKey`, `formatEventWhen`, `eventDateKey`) all format in `America/New_York`, so labels don't depend on the build machine or the visitor's time zone. `formatEventWhen` shows a date range for multi-day events, and omits the time when the start is exactly midnight Eastern ("all-day").

**Calendar.** `event-calendar.ts` builds a Sunday-first month grid. Multi-day events appear on every day in their range.

## Structured code content (`src/lib`)

| Module | Exports | Drives |
| --- | --- | --- |
| `site-config.ts` | `siteConfig` (name, URL, org address/phone/email/EIN, social), `primaryNav`, `cta`, `footerLinks` | Header, footer, metadata, sitemap, DAF panel, form error messages |
| `tours.ts` | `tours: Tour[]` (guided, self-guided, private-group) | Visit tour cards (copy only; FareHarbor holds the real products) |
| `faq.ts` | `visitFaqGroups: FaqGroup[]` (3 groups, about 30 Q&As) | Visit FAQ accordion |
| `venues.ts` | `venues: Venue[]` | Host venue cards |
| `host-content.ts` | `eventTypes`, `inquiryEventTypes`, `guestCountOptions`, `budgetOptions`, `whatsIncluded`, `whyFortAdams`, `hostTestimonials` (**unused placeholder**) | Host page and inquiry form |
| `support-content.ts` | `membershipTiers` (with HighLevel payment-link URLs), `impactStats`, `isJoinable()`, plus legacy `donationPresets`/`donationImpact()` (unused since the hosted-form switch) | Support Us |
| `history.ts` | `historyChapters`, `mapHotspots`, `restorationProjects` | History page. Supports any number of chapters and hotspots; `mapId` links a chapter to a hotspot. |
| `fort-terminology.ts` | `architectureFeatures`, `fortTerms` (about 100) | Architecture & Terminology |
| `explore-fort.ts` | `exploreVideos` (exactly 6), `getExploreMediaUrl()` | Home Explore the Fort. **Throws at build** if not exactly six complete, unique entries with 0–100 coordinates. |

## Placeholders

Content awaiting the client is marked `[PLACEHOLDER: …]`. Find it all with:

```bash
grep -rn "PLACEHOLDER" src content public/admin functions
```

# Component Library

Components are grouped by feature under `src/components/`. Server components are the default. Only components that need browser state are marked `"use client"`.

## UI primitives (`components/ui`)

| Component | Purpose / API |
| --- | --- |
| `Button` / `buttonClasses(variant, size, extra?)` | Renders as a link (`href`) or a `<button>`. Variants: `primary` (brass; reserved for the strongest action), `secondary` (navy), `ghost`, `outline-light` (over photos). Sizes `sm`/`md`/`lg`, all at least 44px tall. Use `buttonClasses` to style plain `<a>` elements, such as FareHarbor or HighLevel links. |
| `Container` | Max-width page gutter wrapper. |
| `Card`, `CardBody` | Bordered card; optional `href` makes the whole card a link. |
| `Badge` | Variants: `featured`, `popular`, `new`, `neutral`, `onImage`. |
| `Tag` | Static pill label (event types on the Host page). |
| `FilterPill` | Toggle pill with `selected` state (event filters, list/calendar toggle). |
| `Accordion` | Accessible disclosure list; `items`, `headingLevel` (2/3/4). |
| `StickyTabNav` | Sticky in-page tab bar; `tabs: {id,label}[]` scroll to section IDs. Sections use `scroll-mt-32 lg:scroll-mt-36` so headings clear the sticky header. |
| `Breadcrumb` | `items: {label, href?}[]`. |
| `FortImage` | `"use client"` wrapper around `next/image`. Empty or null `src`, or a load error, swaps to `/images/placeholders/fort-fallback.svg` (or a custom `fallbackSrc`). **Use it for any image whose source may be missing** (CMS uploads, remote media). |

## Layout (`components/layout`)

| Component | Notes |
| --- | --- |
| `Header` | Client component. Sticky; hamburger below `lg`, with Escape-to-close and body-scroll lock; Donate plus Buy Tickets (a direct FareHarbor link when `bookingUrl` is valid). |
| `Footer` | Org contact details, link columns, social icons, build-time copyright year. |
| `AlertBanner` | Client component. Dismissal is stored in `localStorage` under `fa-alert-dismissed:<hash(message)>`. Uses `useSyncExternalStore` with a server snapshot of "dismissed" to avoid a flash or hydration mismatch. |
| `PageHero` | Photo hero with breadcrumbs, eyebrow, title, and intro, used on most interior pages. |
| `Logo` | Site wordmark/logo. |

## Feature components

| Folder | Components |
| --- | --- |
| `home/` | `HomeHero`, `QuickInfoStrip` (hours/directions/admission/parking, **hard-coded**), `ExploreFort` (client; desktop map with markers and autoplaying video, mobile full-screen vertical-video reel below 1024px, captions support), `UpcomingEvents` (client; horizontal scroller with dots), `AudienceRouter`, `VenueTeaser`, `FortressStory` |
| `visit/` | `TourCard`, `FareharborWidget` (renders a disabled "Online booking opens soon" button if the URL is invalid), `FareharborScript` |
| `events/` | `EventsExplorer` (client; filters and view toggle), `EventsCalendar`, `EventCard` (CTA priority: `externalUrl` → `bookingUrl` → "Learn more"), `FeaturedEventCard`, `EventsSidebar` (subscribe panel only when `NEXT_PUBLIC_EVENTS_SUBSCRIBE_URL` is valid), `EmailSignup` |
| `history/` | `HistoryExperience` (client; chapter ↔ hotspot sync, timeline strip, mobile Story/Map toggle), `RestorationTimeline` |
| `host/` | `VenueCard`, `EventInquiryForm` |
| `support/` | `DonateWidget` (link to the HighLevel form), `DafPanel`, `MembershipTiers`, `LeadForm` (generic webhook form), `SponsorGrid` |

## Conventions

- Keep data in `src/lib` and presentation in `src/components`. Components import typed data rather than defining copy inline, except for page-specific prose in `page.tsx` files.
- Client components receive build-time data as props from server components (for example, `EventsExplorer` gets events from `events/page.tsx`).
- Forms use `useId()` for label/input IDs, move focus to the confirmation message on success, and use `role="status"` / `role="alert"`.

# Styling and Design Tokens

## Tailwind v4, CSS-first

There's no `tailwind.config.js`. Tokens are declared with `@theme` in `src/app/globals.css`, which also holds base-layer styles. PostCSS uses `@tailwindcss/postcss`. Prettier sorts classes via `prettier-plugin-tailwindcss` (configured with `tailwindStylesheet: ./src/app/globals.css`).

## Visual direction

National Park Service / museum feel: confident serif headings, generous whitespace, warm neutrals anchored by deep navy, and a brass accent reserved for primary calls to action.

## Colour tokens

| Scale | Role | Key values |
| --- | --- | --- |
| `navy-50…950` | Structure, text, dark bands | `navy-800 #1e2a3d` (primary navy), `navy-900 #141d2b` (body text, dark sections) |
| `brass-50…900` | **Primary CTA and highlights only** | `brass-500 #b5862f` (primary accent; also the focus ring) |
| `sand-50…300` | Light section backgrounds | `sand-50 #faf7f1` (page background) |
| `stone` (Tailwind built-in) | Borders, neutral UI | `stone-200` borders |

Section bands alternate `bg-white` and `bg-sand-50`. Closing CTAs use `bg-navy-900`.

## Typography

- **Sans:** Inter (`--font-inter`), used for body and UI.
- **Serif:** Source Serif 4 (`--font-source-serif`), used automatically for `h1`–`h4` (base layer) and via `font-serif`.
- Both are loaded with `next/font/google` in `layout.tsx` with `display: swap`.
- Eyebrow pattern: `text-sm font-semibold tracking-[0.15em] text-brass-600 uppercase` above an `h2`.

## Base styles and accessibility

- `:focus-visible` gives a 2px brass outline on every focusable element.
- Smooth scrolling is enabled only under `prefers-reduced-motion: no-preference`.
- Headings use `text-wrap: balance`.
- The `no-scrollbar` utility is used for horizontal pill and card scrollers.

## Rules of thumb

- Use `buttonClasses()` rather than restyling links as buttons by hand.
- Keep touch targets at `min-h-11` (44px) or larger.
- Keep text over photography legible with gradient scrims, as `PageHero` and `HomeHero` do.
- Use only one `brass` primary button per view where possible.

# Images and Media

## Where media lives

| Media | Location | Served from |
| --- | --- | --- |
| Photos, logos, icons, placeholders | `public/images/**` (committed) | Site origin |
| CMS uploads | `public/images/events`, `public/images/staff`, `public/images/sponsors` | Site origin |
| Explore the Fort videos (and optional posters/captions) | R2 bucket, `video/…` | `https://cdn.r2.fortadams.org` |
| Strategic Plan and Annual Report PDFs | R2 bucket, `documents/…` | `https://cdn.r2.fortadams.org` |

## `next/image` with static export

`next.config.ts` sets `images.loader: "custom"` with `loaderFile: ./src/lib/image-loader.ts`, and `dangerouslyAllowSVG: true` (with `contentDispositionType: "attachment"`) for the placeholder SVGs.

The loader:

- **Default:** returns `src` unchanged. Local and remote URLs pass through at original size.
- **With `NEXT_PUBLIC_CF_IMAGE_BASE`:** absolute URLs become `${base}/cdn-cgi/image/width=W,quality=Q,format=auto/${src}`, giving real responsive `srcset` through Cloudflare Image Resizing. The zone must have Image Resizing enabled. Local `/images/...` paths still pass through.

Because local images aren't resized, **optimise them before committing**: use WebP or JPEG at appropriate dimensions. Several legacy assets are large WordPress exports; see the size guidelines in *Administrator Guide → Working with Images*.

## `FortImage`

Use `FortImage` instead of `next/image` whenever a source may be empty or may fail (CMS uploads, remote images). It falls back to `/images/placeholders/fort-fallback.svg`.

## Explore the Fort media

- Records live in `src/lib/explore-fort.ts`: `id`, `location`, `title`, `description`, `videoPath` (relative, URL-encoded), optional `posterPath`, `captionsPath` and `transcript`, and marker `x`/`y` as percentages on `/images/explore/fort-adams-explore-map.webp`. The same map is used by the History page.
- A build-time validator enforces **exactly six** entries with unique IDs, required fields, and coordinates from 0 to 100.
- Base URL: `NEXT_PUBLIC_FORT_MEDIA_BASE`, defaulting to `https://cdn.r2.fortadams.org`.

### R2 / custom-domain requirements

This is configured on the R2 bucket or custom domain, not in Pages `_headers`:

- MP4 **byte-range** responses (seeking and iOS playback) with `Content-Type: video/mp4`
- `text/vtt` for caption files
- Long-lived immutable cache headers. **Version file names** when replacing media, because caches won't see an overwrite.
- **CORS** allowing the site origin to fetch video, poster, and caption files (captions via `<track>` need CORS)

## Replacing or adding media

- **Swap a video:** upload the new file to R2 under a new name, update `videoPath`, and deploy.
- **Move a marker:** adjust `x`/`y` in `explore-fort.ts`. Recent commits did this iteratively; check it visually on desktop.
- **New PDF:** upload to R2 `documents/` and update the link in `src/app/about/page.tsx`.

# FareHarbor Integration

FareHarbor is the source of truth for tours, availability, pricing, checkout, and confirmations. The site doesn't use the FareHarbor API and doesn't store item IDs.

## How it works

1. `layout.tsx` renders `<FareharborScript />` (a `next/script` with `afterInteractive`) **only if** `getTourBooking().bookingUrl` is valid:

   ```
   https://fareharbor.com/embeds/api/v1/?autolightframe=yes
   ```

2. With `autolightframe=yes`, FareHarbor intercepts clicks on any `<a href="https://fareharbor.com/embeds/book/…">` and opens its **Lightframe** overlay instead of navigating away.
3. `FareharborWidget` renders the *Book now* anchor, styled with `buttonClasses`, or a disabled button reading "Online booking opens soon" if the URL fails `isFareharborBookingUrl()`.
4. The header's **Buy Tickets** is a direct FareHarbor anchor when a URL exists, and otherwise falls back to `/visit/#tours`.

## Configuration

`content/tour-booking.json`, edited via Decap → **Alerts & Booking → Update tour booking links**:

| Key | Required | Used by |
| --- | --- | --- |
| `bookingUrl` | Yes | Header Buy Tickets, self-guided and private/group cards, Visit closing CTA |
| `guidedBookingUrl` | No | Guided Tour card only; falls back to `bookingUrl` |

Validation happens in two places:

- **Decap** (`config.yml` `pattern`): `^https://fareharbor\.com/embeds/book/[^/?#]+/?(?:\?.*)?$` for the default link, and a slightly looser pattern allowing sub-paths for the guided link.
- **Runtime** (`isFareharborBookingUrl`): https scheme, host exactly `fareharbor.com`, path starting `/embeds/book/`. Anything else is treated as empty.

Current default: `https://fareharbor.com/embeds/book/fortadamstrust/?full-items=yes` (company short name `fortadamstrust`).

## Why URLs, not embed code

Editors paste a URL rather than FareHarbor's HTML/JS snippet. The app supplies the script itself, so the CMS never stores arbitrary markup, which would be both brittle and an XSS risk.

## Keeping copy in sync

The Visit page's tour cards (`src/lib/tours.ts`) contain descriptive copy, durations, and "From $…" price labels that FareHarbor doesn't feed. Update them whenever FareHarbor products or prices change. The Visit page itself states that "Tour availability and final pricing are confirmed during booking."

# HighLevel Integrations

HighLevel (LeadConnector; white-labelled at `crm.fortadams.org`) is the CRM. The site integrates with it in four independent ways:

| Integration | Mechanism | Code |
| --- | --- | --- |
| Event inquiries | Server-side API calls from a Pages Function | `functions/api/event-inquiry.ts`, `components/host/EventInquiryForm.tsx` |
| Volunteer / corporate / newsletter leads | Browser `no-cors` POST to inbound webhooks | `components/support/LeadForm.tsx`, `components/events/EmailSignup.tsx` |
| Donations | Link to a hosted form | `components/support/DonateWidget.tsx` |
| Memberships | Links to hosted recurring payment links | `lib/support-content.ts`, `components/support/MembershipTiers.tsx` |

## 1. Event inquiry Pages Function

`POST /api/event-inquiry` (same origin). The browser sends JSON:

```json
{ "firstName": "", "lastName": "", "email": "", "phone": "", "company": "",
  "eventType": "", "guestCount": "", "budget": "", "preferredDate": "", "message": "" }
```

The function then:

1. **Origin check.** If an `Origin` header is present and differs from the request's origin → `403`.
2. **Config check.** If any required secret is missing → `503 "Event inquiry service is not configured."`
3. **Validation.** It trims all strings. Missing `firstName`, `lastName`, `email`, or `eventType` → `400`.
4. **Contact upsert.** `POST https://services.leadconnectorhq.com/contacts/upsert`, headers `Authorization: Bearer <token>` and `Version: v3`, with `locationId`, names, email, phone, `companyName`, `source: "Website — Event Inquiry"`, and `tags: ["Event Inquiry","Website"]`. The contact ID is read from `id` or `contact.id`. On failure → `502`.
5. **Opportunity.** `POST /opportunities/` with `pipelineId`, `pipelineStageId`, `contactId`, `name: "Event Inquiry — {First Last} ({eventType})"`, `status: "open"`, the source, `monetaryValue` from the budget map, and optional `customFields` (`[{id, fieldValue}]`, included only for configured IDs with non-empty values). On failure → `502`.
6. Returns `200 {"success": true}` with `Cache-Control: no-store`.

The form shows its confirmation **only** on `response.ok && success === true`.

**Secrets** (Cloudflare Pages → Settings → Variables and Secrets, encrypted, for Production and Preview):

| Name | Required |
| --- | --- |
| `GHL_PRIVATE_INTEGRATION_TOKEN` | Yes. A Private Integration token with contacts and opportunities write scopes. |
| `GHL_LOCATION_ID` | Yes |
| `GHL_EVENTS_PIPELINE_ID` | Yes |
| `GHL_EVENTS_PIPELINE_STAGE_ID` | Yes |
| `GHL_EVENT_TYPE_FIELD_ID`, `GHL_EVENT_GUEST_COUNT_FIELD_ID`, `GHL_EVENT_BUDGET_FIELD_ID`, `GHL_EVENT_DATE_FIELD_ID`, `GHL_EVENT_MESSAGE_FIELD_ID` | Optional opportunity custom-field IDs |

<p class="callout warning">The budget-to-value map is duplicated. <code>budgetOptions</code> in <code>src/lib/host-content.ts</code> provides the dropdown labels, and <code>budgetValues</code> in <code>functions/api/event-inquiry.ts</code> maps those labels to numbers. If you change a label in one place, change the other, or the value silently becomes 0.</p>

**Hardening gaps:** there's no CAPTCHA, honeypot, or rate limiting, and a request without an `Origin` header (a non-browser client) passes the origin check. If spam appears, add Cloudflare Turnstile verification in the function, or a WAF rate-limit rule on `/api/event-inquiry`.

## 2. Webhook lead forms

`LeadForm` (configured per use in `support-us/page.tsx`) and `EmailSignup` POST JSON as `text/plain` with `mode: "no-cors"`. That makes the request CORS-simple, but the response is **opaque**: the browser can't read the status. Payloads:

- **LeadForm:** every field value, plus `name`, `source`, `tags`, `opportunityName` (`"<prefix> — <name>"`), and `submittedAt`. The corporate form adds `companyName`.
- **EmailSignup:** `email`, `source: "Website — Events Newsletter"`, `tags: ["Newsletter","Website"]`, `submittedAt`.

Env vars (public, baked into the build): `NEXT_PUBLIC_VOLUNTEER_WEBHOOK_URL`, `NEXT_PUBLIC_CORPORATE_WEBHOOK_URL`, `NEXT_PUBLIC_NEWSLETTER_WEBHOOK_URL`. A URL is treated as "ready" only if it starts with `http(s)://` and doesn't contain `example.com`.

<p class="callout danger">If a webhook URL isn't ready, the form waits 500 ms and shows success <strong>without sending anything</strong>. Even when it is ready, success is shown whatever HighLevel returns. Confirm the production values in Cloudflare, and consider moving these forms behind a Pages Function like the event inquiry so failures are visible.</p>

HighLevel side: create one inbound-webhook workflow per form, map the fields to the contact and opportunity, and route to the volunteer or corporate/sponsorship pipeline.

## 3. Donations

`DonateWidget` links to the hosted **Web Donation** form `https://crm.fortadams.org/widget/form/okXo0SaqzMNahWJzB1YZ`. There's no iframe, embed script, or amount prefill, because prefill wasn't verified for this form. The old `NEXT_PUBLIC_DONATION_PROVIDER` and `NEXT_PUBLIC_DONATION_EMBED_CONFIG` variables are obsolete and can be deleted from Cloudflare. The CRM-side checklist (matching, designations, receipts, refunds, testing) is in *Administrator Guide → Donations and Memberships*.

`DafPanel` embeds `NEXT_PUBLIC_DAF_WIDGET_URL` in an iframe when set (Chariot/DAFpay style). Otherwise it shows the legal name, EIN, and address from `siteConfig.org`.

## 4. Memberships

`membershipTiers` in `src/lib/support-content.ts`. Each tier has a `joinUrl` of `https://crm.fortadams.org/payment-link/<id>`:

| Tier | Price | Payment link ID |
| --- | --- | --- |
| Individual | $50 | `6a033d0c8c3f15f97515abb9` |
| Family | $75 | `6a033d5f1d5a394a682e43a6` |
| Patron | $500 | `6a033d291d5a394a682e43a4` |
| Benefactor | $1,000 | `6a033d438c3f15f97515abbb` |

These are public identifiers, not credentials. Each points to a HighLevel **recurring product**. The first successful payment creates the contact and the subscription natively. **Don't** create subscriptions via the API: HighLevel's API can only list and get subscriptions, and creating one would duplicate it. `isJoinable()` disables the button ("Online membership opens soon") for a non-http or `example.com` URL. Setting `featured: true` on a tier adds a "Most popular" badge and brass styling.

# Decap CMS Configuration

## Files

| File | Purpose |
| --- | --- |
| `public/admin/index.html` | **Staff workspace** (`/admin/`): a static task dashboard. Each card deep-links into the editor (for example `/admin/edit/#/collections/events/entries/event_list`). Includes a publishing explainer and a help section. No Decap code loads here. |
| `public/admin/workspace.css` | Styles for the workspace and the editor loading screen |
| `public/admin/workspace.js` | Redirects old Decap bookmarks (`/admin/#/…`) to `/admin/edit/#/…` |
| `public/admin/edit/index.html` | **Editor** (`/admin/edit/`): points Decap at `/admin/config.yml` via `<link rel="cms-config-url">`, shows a loading screen, and mounts Decap into `#nc-root` |
| `public/admin/editor-loader.js` | Injects Decap from unpkg, **pinned to `decap-cms@3.8.4`**. Hides the loading screen once Decap renders. After 20 s shows a slow-connection message, or an error message if the script fails to load. |
| `public/admin/config.yml` | Backend, media folders, and collections |

All admin pages are `noindex, nofollow`, and robots disallows `/admin`.

<p class="callout info">To upgrade Decap, change the pinned version in <code>editor-loader.js</code>, then test sign-in and every collection locally (<code>npx decap-server</code>) before deploying. An unpkg outage affects only the editor, never the public site.</p>

<p class="callout warning">The workspace cards hard-code collection and file <code>name</code>s in their URLs. If you rename a collection or file entry in <code>config.yml</code>, update the matching card link in <code>index.html</code>.</p>

## Backend and authentication

```yaml
backend:
  name: github
  repo: pmgasset/fortadamswebsite
  branch: main
  base_url: https://decap-oauth.fortadams.org   # OAuth proxy
local_backend: true
site_url: https://www.fortadams.org
```

- There's **no `publish_mode: editorial_workflow`**, so every Publish commits straight to `main` and deploys.
- The GitHub backend needs an **OAuth proxy**, because GitHub's OAuth flow requires a client secret. Setup:
  1. Create a **GitHub OAuth App** (org or user Settings → Developer settings → OAuth Apps). Set the callback URL to the proxy's callback endpoint.
  2. Deploy a proxy, for example the Cloudflare Worker [`sterlingwes/decap-proxy`](https://github.com/sterlingwes/decap-proxy) or [`i40west/netlify-cms-oauth`](https://github.com/i40west/netlify-cms-oauth), with `GITHUB_OAUTH_CLIENT_ID` and `GITHUB_OAUTH_CLIENT_SECRET`, on `decap-oauth.fortadams.org`.
  3. Keep `backend.base_url` pointing at it, and confirm the proxy is live before launch.
- Editors need write access to the repo.

## Collections

The header comment in `config.yml` says it: **keep collection, file, and field `name`s stable**, because they map to existing JSON keys and paths. Labels can change freely.

| Collection label (`name`) | File entry label (`name`) | Target | Media folder |
| --- | --- | --- | --- |
| Special Events (`events`) | Add or update events (`event_list`) | `content/events.json` | `public/images/events` |
| | Event Categories (`event_categories`) | `content/event-categories.json` | |
| Alerts & Booking (`settings`) | Update the announcement banner (`alert`) | `content/alert.json` | global: `public/images/staff` |
| | Update tour booking links (`tour_booking`) | `content/tour-booking.json` | |
| Staff & Board (`staff`) | Update staff & board (`directory`) | `content/staff.json` | global: `public/images/staff` |
| Sponsors & Partners (`sponsors`) | Update sponsor recognition (`annual_sponsors`) | `content/sponsors.json` | `public/images/sponsors` |

All collections are **file collections** (one JSON file each, with list widgets) and set `delete: false`, so editors can't delete the underlying files. Global options: `editor.preview: false` (no preview pane), `logo_url` (the Trust logo on the login screen), and `display_url` pointing at `/admin/`. Lists are `collapsed: true`, `required: false`, `default: []`.

Notable field configuration:

- **Alert message:** `pattern: ^.{0,120}$`.
- **Tour URLs:** regex patterns (see *FareHarbor Integration*).
- **Event `isPublished`:** `default: false`, so **new events start hidden** until the editor switches them on.
- **Event list:** `add_to_top: true`, `allow_reorder: false` (the site sorts by date).
- **Event category:** a `relation` widget into `event_categories` (`value_field: categories.*.name`). It stores the **name string**, so renames don't cascade.
- **Event dates:** `datetime`, `format: YYYY-MM-DDTHH:mm:ssZ`, `picker_utc: false`, displayed as `MMM D, YYYY` / `h:mm A`. The stored offset comes from the **editor's device time zone**, hence the "set your device to Eastern Time" hint.
- **Event id:** a `hidden` widget, never set by Decap for new entries. `getPublicEvents()` generates one.
- **Event `externalUrl`:** `^$|^https?://[^\s/?#]+[^\s]*$`. **`bookingUrl`:** `^$|^/(?!/)[^\s]*$` (site paths only, no protocol-relative `//`).
- **Staff `email`:** `^$|^[^\s@]+@[^\s@]+\.[^\s@]+$`.
- **Sponsor `year`:** `^[0-9]{4}$`. **Sponsor `website`:** same pattern as event `externalUrl`. `add_to_top: true`.

## Adding a CMS-editable field or area

1. Add the field to the JSON file in `content/` with a sensible default, so existing data stays valid.
2. Update the TypeScript interface and loader in `src/lib/`, treating the field as optional for older data.
3. Add the widget to `config.yml`. Mirror the constraints with `pattern`, `required`, and `hint`.
4. Render it in the component.
5. Test locally with `npx decap-server` (see *Local Development Setup*), then `npm run build`.

Keep new areas constrained: validated strings, booleans, lists, and images. Avoid rich-text or HTML fields that let editors break layouts or inject markup.

# Build and Deployment

## Cloudflare Pages project settings

| Setting | Value |
| --- | --- |
| Source | GitHub `pmgasset/fortadamswebsite`, production branch `main` |
| Framework preset | None / Next.js (Static HTML Export) |
| Build command | `npm run build` |
| Build output directory | `out` |
| Node version | 20+ (set `NODE_VERSION` if the default is older) |
| Functions | Auto-detected from the root `functions/` directory |

- **Production deploys:** every push to `main`, including every Decap publish.
- **Preview deploys:** every other branch and PR gets a unique `*.pages.dev` URL. Preview uses the *Preview* environment's variables. Set the `GHL_*` secrets there too, ideally pointing at a test pipeline.

## Environment variables

Configure them under **Workers & Pages → project → Settings → Variables and Secrets**. `NEXT_PUBLIC_*` values are compiled into the JavaScript bundle, so **changing one requires a redeploy**. The `GHL_*` secrets are read by the Function at request time. Full list: *Reference → Environment Variables*.

## Deploying

- **Normal:** merge or push to `main`, then watch *Deployments*.
- **Rebuild without code changes** (for example, to drop past events or pick up a changed env var): *Deployments → latest production deployment → ⋯ → Retry deployment*.
- **Roll back:** *Deployments → a previous successful deployment → ⋯ → Rollback to this deployment*. This is instant. Remember that the next push to `main` deploys the current `main` again, so also revert the bad commit.

## Scheduled rebuilds (recommended)

Because "upcoming" events are computed at build time, schedule a daily rebuild:

1. **Pages → Settings → Builds → Deploy hooks**: create a hook for `main` and copy its URL. Treat it as a secret.
2. Call it daily just after midnight Eastern, from a Cloudflare Worker Cron Trigger (`curl -X POST <hook>`) or a GitHub Actions `schedule` workflow.

This hasn't been set up yet; it's tracked in *Known Issues and Open Items*.

## Redirects and headers

- `public/_redirects` is copied to `out/_redirects` and applied by Pages. It currently has one rule (`/preservation/restoration-projects/` → `/history/#restoration-projects`, 301) plus commented, **guessed** examples. Populate it from a crawl of the old WordPress site before DNS cutover.
- There's no `_headers` file. Security headers (CSP, HSTS, etc.) aren't configured at the Pages level. If you add a CSP, allow `fareharbor.com`, `cdn.r2.fortadams.org`, `crm.fortadams.org`, the HighLevel webhook hosts, `www.google.com` (map iframe), and `unpkg.com` (for `/admin` only).

## Domains

The production canonical URL is `siteConfig.url` (`https://www.fortadams.org`), used for `metadataBase`, the sitemap, and robots. Attach both apex and `www` under **Pages → Custom domains** and redirect one to the other. Confirm the final domain before launch; it's still marked `[PLACEHOLDER]`.

# SEO and Accessibility

## SEO

- **Metadata:** every page exports `title`, `description`, and `alternates.canonical`. The root layout sets `metadataBase` from `siteConfig.url`, the title template `%s · Fort Adams Trust`, Open Graph defaults, and `twitter.card: summary_large_image`.
- **OG image:** currently `/images/og-default.svg` (placeholder). Many social platforms don't render SVG OG images. Add a real **1200×630 JPG/PNG** and update `layout.tsx`.
- **Sitemap:** `src/app/sitemap.ts` lists routes explicitly. Events get `changeFrequency: weekly`, others monthly; home has priority 1. **Add new routes by hand.**
- **Robots:** `src/app/robots.ts` allows everything except `/admin`, and links the sitemap.
- **Redirects:** `public/_redirects`. Map every indexed WordPress URL before launch to keep search rankings.
- **Headings:** one `h1` per page, with sections labelled by `aria-labelledby` headings.

## Accessibility (target: WCAG 2.1 AA)

Implemented patterns to keep when adding features:

| Area | Pattern |
| --- | --- |
| Landmarks | A skip link to `#main-content` (first focusable element), plus `header`/`main`/`footer`; the alert banner is `role="region"` with a label |
| Focus | Global brass `:focus-visible` outline; focus moves to confirmation messages after form success; Escape closes the mobile menu |
| Targets | Buttons and inputs at least 44px (`min-h-11`) |
| Images | Meaningful `alt` on all content images; `alt=""` for decorative; sponsor logos use "<Name> logo" |
| Forms | Visible labels bound with `useId`, required markers, `role="alert"` errors, `role="status"` success |
| Widgets | ARIA on the accordion, sticky tabs, filter pill groups (`role="group"` + `aria-label`), menu, and carousel dots |
| Media | Explore videos support WebVTT captions (`captionsPath`) and transcripts. **Add captions for all six videos.** |
| Motion | Smooth scroll only when `prefers-reduced-motion: no-preference` |
| Contrast | Gradient scrims behind text on photos; brass-on-navy and navy-on-sand palettes |
| Embeds | Titled iframes (Google Map, DAF widget) |

When adding UI, check it with keyboard only, with a screen reader (VoiceOver or NVDA), and with Lighthouse/axe.

# Conventions and Workflow

## Code style

- **TypeScript strict.** Import via the `@/` alias (`@/lib/...`, `@/components/...`).
- **Prettier:** 100-character lines, double quotes, semicolons, trailing commas, Tailwind class sorting. Run `npm run format`.
- **ESLint:** `eslint-config-next` core-web-vitals + TypeScript. Unused bindings prefixed with `_` are allowed.
- **Comments:** explain *why*, especially around integrations and static-export constraints. Match the density of the surrounding file.
- **Placeholders:** mark content awaiting the client with `[PLACEHOLDER: …]` so it can be found with grep.

## Architecture rules

- **Server components by default.** Add `"use client"` only for state, effects, or browser APIs.
- **Data in `src/lib`, presentation in `src/components`.** Page-specific prose can live in `page.tsx`.
- **Nothing that needs a server at runtime** except in `functions/`. No route handlers, server actions, `headers()`/`cookies()`, or ISR. They break `output: "export"`.
- **Never expose secrets through `NEXT_PUBLIC_*`.** Anything needing a secret goes in a Pages Function.
- **Keep third-party specifics isolated**: FareHarbor in `content.ts` and `FareharborWidget`; HighLevel in the Function, `LeadForm`, `EmailSignup`, `DonateWidget`, and `support-content.ts`.
- **Payments never touch the site.** Link to provider-hosted checkouts.
- **Validate at the edge of CMS data.** Loaders should tolerate missing optional fields and bad URLs (see `getTourBooking`).
- **Before using a Next.js API, check `node_modules/next/dist/docs/`** (per `AGENTS.md`). Next 16 has breaking changes.

## Workflow

1. `git pull` first. Decap commits to `main` frequently.
2. Work on a branch for anything non-trivial. Pushing it gives you a Cloudflare preview URL to share for review.
3. `npm run lint && npm run format:check && npm run build` before merging.
4. Merge to `main`, then verify on production.
5. If a change affects editors or admins (a new CMS field, changed behaviour), update this book (see *Maintaining This Book*).

Commit messages in this repo are short imperative summaries, for example "Link donations to HighLevel hosted checkout" or "Add annual corporate sponsors directory".

# Common Development Tasks

Short recipes for the most frequent requests. After each one, run `npm run build` and check the page locally before pushing.

## Update hours, season, or tour times

- **Visit page:** the `dl` rows in the *Hours & Season* section of `src/app/visit/page.tsx`, and the intro sentence in `PageHero`.
- **Home quick facts:** `src/components/home/QuickInfoStrip.tsx` ("Open daily, Apr–Nov").
- **FAQ:** "What are the hours of operation?" in `src/lib/faq.ts`.

## Update tour cards or prices

Edit `src/lib/tours.ts` (`priceLabel`, `duration`, `highlights`, `badges`). The admission note ("Admission starts at $10…") is in `src/app/visit/page.tsx`, and "Admission from $10" is in `QuickInfoStrip.tsx`.

## Add or edit an FAQ

Add an object `{ question, answer }` to the right group in `visitFaqGroups` (`src/lib/faq.ts`). The accordion picks it up automatically.

## Change a membership tier

Edit the tier in `membershipTiers` (`src/lib/support-content.ts`): `price`, `benefits`, `tagline`, and `joinUrl` (the HighLevel payment-link ID). Coordinate with the HighLevel product so the price matches the checkout. Set `featured: true` to highlight a tier.

## Change the donation form

Update `DONATION_CHECKOUT_URL` in `src/components/support/DonateWidget.tsx`.

## Update contact details or social links

`siteConfig.org` and `siteConfig.social` in `src/lib/site-config.ts`. The footer, DAF panel, and form error messages update automatically.

## Add a venue

Add a `Venue` to `src/lib/venues.ts`, and put optimised images in `public/images/venues/`. Venues render in array order.

## Add a history chapter, hotspot, or restoration project

Append to `historyChapters`, `mapHotspots`, or `restorationProjects` in `src/lib/history.ts`. Link a chapter to a hotspot with `mapId` = hotspot `id`. Hotspot `x`/`y` are percentages on the fort map. Mark the present-day chapter with `isPresent: true`.

## Add a glossary term

Add `{ term, definition }` to `fortTerms` in `src/lib/fort-terminology.ts`. Keep the list alphabetical, because the page groups terms by first letter in array order.

## Add a new page

1. Create `src/app/<slug>/page.tsx` with a `metadata` export (`title`, `description`, `alternates.canonical`).
2. Use `PageHero` (or `Breadcrumb` plus a header band), `Container`, and the section and heading patterns from existing pages.
3. Add the route to `routes` in `src/app/sitemap.ts`.
4. Add it to `primaryNav` and/or `footerLinks` in `site-config.ts` if it needs a link.
5. If it replaces an old WordPress URL, add a 301 in `public/_redirects`.

## Add a redirect

Append `<old-path> <new-path> 301` to `public/_redirects`. Use trailing slashes on internal targets (the site uses `trailingSlash: true`).

## Replace an Explore the Fort video

Upload the new MP4 to R2 under a **new file name**, update `videoPath` in `src/lib/explore-fort.ts`, and optionally add `captionsPath` (VTT) and `posterPath`. The list must stay at exactly six entries.

## Add a new webhook-backed form

Reuse `LeadForm` with a new `NEXT_PUBLIC_*_WEBHOOK_URL`, and set `source`, `tags`, and `opportunityPrefix`. Better still, when delivery must be confirmed, add a Pages Function modelled on `event-inquiry.ts`.

## Expose something new in the CMS

See *Decap CMS Configuration → Adding a CMS-editable field or area*.

# Reference

Lookup material for developers and administrators: environment variables, known issues, the launch checklist, and how to keep this book current.

# Environment Variables

Set these in **Cloudflare → Workers & Pages → project → Settings → Variables and Secrets**, for both Production and Preview. For local development, copy `.env.example` to `.env.local`.

<p class="callout warning"><code>NEXT_PUBLIC_*</code> variables are <strong>public</strong>. They're compiled into the browser JavaScript at build time, so changing one requires a redeploy. Never put a secret in a <code>NEXT_PUBLIC_*</code> variable.</p>

## Server secrets (Pages Function)

| Variable | Required | Purpose |
| --- | --- | --- |
| `GHL_PRIVATE_INTEGRATION_TOKEN` | **Yes** | HighLevel Private Integration token (contacts and opportunities write). Encrypted secret. |
| `GHL_LOCATION_ID` | **Yes** | HighLevel sub-account (location) ID |
| `GHL_EVENTS_PIPELINE_ID` | **Yes** | Pipeline for event inquiries |
| `GHL_EVENTS_PIPELINE_STAGE_ID` | **Yes** | Starting stage for new inquiries |
| `GHL_EVENT_TYPE_FIELD_ID` | No | Opportunity custom field: event type |
| `GHL_EVENT_GUEST_COUNT_FIELD_ID` | No | Opportunity custom field: guest count |
| `GHL_EVENT_BUDGET_FIELD_ID` | No | Opportunity custom field: budget label |
| `GHL_EVENT_DATE_FIELD_ID` | No | Opportunity custom field: preferred date |
| `GHL_EVENT_MESSAGE_FIELD_ID` | No | Opportunity custom field: message |

If any required variable is missing, `/api/event-inquiry` returns `503` and the form shows its error message.

## Public build-time variables

| Variable | Default / example | Effect when empty or placeholder |
| --- | --- | --- |
| `NEXT_PUBLIC_VOLUNTEER_WEBHOOK_URL` | `https://example.com/webhook/placeholder` | The volunteer form **fakes success and sends nothing** |
| `NEXT_PUBLIC_CORPORATE_WEBHOOK_URL` | `https://example.com/webhook/placeholder` | The corporate form **fakes success and sends nothing** |
| `NEXT_PUBLIC_NEWSLETTER_WEBHOOK_URL` | `https://example.com/webhook/placeholder` | The newsletter sign-up **fakes success and sends nothing** |
| `NEXT_PUBLIC_EVENTS_SUBSCRIBE_URL` | (empty) | The "Add to your calendar" panel is hidden. Accepts `https://` or `webcal://`. |
| `NEXT_PUBLIC_DAF_WIDGET_URL` | (empty) | The DAF panel shows legal name, EIN, and address instead of an embedded widget |
| `NEXT_PUBLIC_CF_IMAGE_BASE` | (empty) | Images are served at original size (no Cloudflare resizing) |
| `NEXT_PUBLIC_FORT_MEDIA_BASE` | `https://cdn.r2.fortadams.org` | Falls back to the same default in code |

## Obsolete (safe to delete from Cloudflare)

- `NEXT_PUBLIC_DONATION_PROVIDER`
- `NEXT_PUBLIC_DONATION_EMBED_CONFIG`

## Configured elsewhere (not in this project)

| Variable | Where |
| --- | --- |
| `GITHUB_OAUTH_CLIENT_ID`, `GITHUB_OAUTH_CLIENT_SECRET` | The Decap OAuth proxy Worker at `decap-oauth.fortadams.org` |

## Not environment variables (for reference)

These integration settings are in code or content, not in environment variables:

| Setting | Location |
| --- | --- |
| FareHarbor booking URLs | `content/tour-booking.json` (CMS) |
| Donation form URL | `src/components/support/DonateWidget.tsx` |
| Membership payment links | `src/lib/support-content.ts` |
| Production site URL | `src/lib/site-config.ts` (`siteConfig.url`) |
| Decap OAuth proxy URL | `public/admin/config.yml` (`backend.base_url`) |

# Known Issues and Open Items

Issues and gaps found in a review of the code on **28 September 2026**. Update the status column as items are resolved, and add new ones as they're found.

## Issues

| # | Severity | Issue | Impact | Suggested fix | Status |
| --- | --- | --- | --- | --- | --- |
| 1 | **High** | Volunteer, corporate, and newsletter forms show "Thank you" even when nothing is sent: a placeholder or empty webhook URL simulates success, and `no-cors` hides HighLevel errors. | Leads silently lost | Confirm real webhook URLs are set in Cloudflare Production; submit test entries; ideally move these forms behind a Pages Function that reports failure | Open: verify production values |
| 2 | **High** | The footer links to `/privacy`, but no Privacy Policy page exists. | 404 on every page's footer link; a privacy policy is expected where forms collect personal data | Add `src/app/privacy/page.tsx` with approved policy text, and add it to the sitemap | Open |
| 3 | Medium | "Upcoming" events are computed at build time, and there's no scheduled rebuild. | Past events stay on Home and Events until someone publishes | Add a Cloudflare deploy hook called daily (see *Build and Deployment*) | Open |
| 4 | Medium | No spam protection or rate limiting on `/api/event-inquiry`; requests without an `Origin` header bypass the origin check. | Spam contacts and opportunities in HighLevel | Add Cloudflare Turnstile and/or a WAF rate limit | Open |
| 5 | Medium | HighLevel donation setup incomplete: matching, designations and campaigns, receipts, refunds, and end-to-end tests. | Gifts may be misclassified or unreceipted | Complete the checklist in *Donations and Memberships* | Open (HighLevel) |
| 6 | Medium | `public/_redirects` isn't populated from the old WordPress site. | Lost search rankings and broken inbound links at launch | Crawl the old site and map every URL | Open: pre-launch |
| 7 | Medium | Event times are stored with the **editor's browser time zone** offset. | Wrong times if entered from a non-Eastern computer | Train editors (documented); optionally normalise to Eastern in `getPublicEvents()` | Mitigated by docs |
| 8 | Low | Decap CMS was loaded from unpkg with a floating `^3.8.0` range. | An upstream release could change or break the editor | Pinned to `3.8.4` in `editor-loader.js` | Fixed in working copy (28 Sep 2026); confirm once committed |
| 9 | Low | Budget → value map duplicated in `host-content.ts` and `functions/api/event-inquiry.ts`. | Label edits silently zero the opportunity value | Import one shared map, or document it (done) | Open |
| 10 | Low | Default OG image is an SVG placeholder. | Poor or missing link previews on social media | Add a 1200×630 JPG and update `layout.tsx` | Open: pre-launch |
| 11 | Low | Category rename doesn't cascade to events (relation stores the name). | Events drop out of filters | Documented rename procedure | Mitigated by docs |
| 12 | Low | No CI; builds are only verified by Cloudflare Pages. | Broken builds are found after pushing | Add a GitHub Actions workflow running lint, format check, and build on PRs | Open |
| 13 | Low | No security headers (`_headers`). | Missing CSP/HSTS hardening | Add `public/_headers` (see allow-list in *Build and Deployment*) | Open |
| 14 | Info | Unused code: `hostTestimonials` (placeholder quotes), `donationPresets` / `donationImpact()`. | None visible; confusion | Remove, or wire in real testimonials | Open |
| 15 | Info | `README.md` is partly outdated (describes four CMS areas; omits sponsors and event categories). | Developer confusion | Point README at this book, or update it | Open |
| 16 | Info | Explore the Fort videos have no captions or transcripts configured. | Accessibility (WCAG 1.2) | Add `captionsPath` VTT files in R2 | Open |

## Content still marked as placeholder

Found with `grep -rn PLACEHOLDER src content public/admin functions`:

- Production domain (`siteConfig.url`)
- Public phone and email
- Official social media URLs
- Membership pricing and benefits confirmation
- What's included with event rentals
- Decap OAuth proxy: confirm `decap-oauth.fortadams.org` is deployed and working
- Real OG image

Other items to confirm with the Trust: the official logo asset (currently a wordmark), final FAQ wording, history chapter images (several use placeholder art), and staff photos (all currently placeholders).

# Launch Checklist

Work through this before pointing `fortadams.org` at the new site, and again after any major change. Use BookStack's edit mode to tick items off.

## Content

- [ ] All `[PLACEHOLDER: …]` items resolved (see *Known Issues and Open Items*)
- [ ] Phone, email, address, and social links confirmed in `site-config.ts`
- [ ] Hours, season, tour times, and prices match FareHarbor and current operations
- [ ] Membership tiers, prices, and benefits match the HighLevel products
- [ ] Staff photos uploaded; staff and board lists current
- [ ] Current sponsors and sponsorship year set
- [ ] Upcoming events entered; one featured (optional)
- [ ] Alert banner message current, or switched off
- [ ] Privacy Policy page published

## Integrations

- [ ] FareHarbor: every *Book now* and *Buy Tickets* button opens the Lightframe and completes a test booking (then refund it)
- [ ] Event inquiry: test submission creates a contact and an opportunity in the right pipeline and stage; the staff notification arrives
- [ ] Volunteer, corporate, and newsletter: real webhook URLs set in Production; test submissions arrive in HighLevel
- [ ] Donation: test gift completes; contact matched; receipt sent; designation recorded; refund handled
- [ ] Each membership tier: checkout completes; subscription appears in HighLevel; onboarding workflow fires
- [ ] Old CRM auto-renewals switched off before HighLevel renewals begin (no double billing)
- [ ] Explore the Fort videos play on desktop and mobile (iOS Safari included); captions load

## CMS

- [ ] OAuth proxy live at `decap-oauth.fortadams.org` and sign-in works end to end
- [ ] Every editor can sign in and publish a test change
- [ ] At least two Trust staff have admin access to GitHub, Cloudflare, FareHarbor, and HighLevel

## SEO and hosting

- [ ] `siteConfig.url` is the final domain; sitemap and canonical URLs correct
- [ ] Custom domains attached in Cloudflare Pages (apex and `www`, one redirecting to the other); HTTPS active
- [ ] `public/_redirects` populated from a crawl of the old WordPress site; top old URLs spot-checked
- [ ] Real OG image in place; link previews checked (for example, with a social debugger)
- [ ] Sitemap submitted to Google Search Console
- [ ] Daily rebuild (deploy hook) scheduled
- [ ] Obsolete donation environment variables removed

## Quality

- [ ] `npm run lint`, `npm run format:check`, and `npm run build` pass
- [ ] Every page checked at phone, tablet, and desktop widths
- [ ] Keyboard-only walkthrough of navigation, forms, filters, accordion, and the Explore map
- [ ] Lighthouse/axe accessibility and performance checks on Home, Visit, and Events
- [ ] No 404s from internal links (including the footer)

# Maintaining This Book

The master copy of this book is in the website repository at `docs/bookstack/`, next to the code it describes. It's written as Markdown, one file per page, and packaged into a BookStack import file.

```
docs/bookstack/
├── book.json            # book/chapter names, descriptions, tags, page order
├── build-book.mjs       # packs everything into a BookStack ZIP
└── pages/
    ├── 01-overview/*.md
    ├── 02-admin/*.md
    ├── 03-developer/*.md
    └── 04-reference/*.md
```

## When to update it

- **A developer changes behaviour** that editors or admins see: update the *Administrator Guide* in the same pull request.
- **A new CMS field, env var, integration, or route**: update the matching *Developer Guide* and *Reference* pages.
- **A known issue is fixed**: update its status in *Known Issues and Open Items*.
- **Staff find an instruction unclear**: fix it here.

## Two ways to edit

**Option A: edit in BookStack.** Quick, but the repository copy goes stale. If you edit in BookStack, tell the developer so they can copy the change back into `docs/bookstack/pages/`. Otherwise the next re-import will overwrite it.

**Option B: edit in the repository (recommended for structural changes).**

1. Edit or add Markdown files under `docs/bookstack/pages/`. Don't repeat the page title as a heading; BookStack shows it. Start sections at `##`.
2. Register new pages in `book.json`. Array order sets the page order.
3. Build the import file:

   ```bash
   node docs/bookstack/build-book.mjs
   # → docs/bookstack/fort-adams-website-book.zip
   ```

4. In BookStack, go to **Books → Import** (or **Settings → Import**, depending on version), upload the ZIP, review, and import. You need BookStack **v24.12 or newer** and the *Import content* permission.

## Re-importing

A ZIP import always creates a **new** book; it doesn't merge into the existing one. To replace the book:

1. Import the new ZIP. It appears as a second book.
2. Check it, then move over any edits made only in the old copy.
3. Delete the old book, or move it to an archive shelf. Note that links and bookmarks to old pages will change.

For small changes, it's usually easier to edit the one page in BookStack and mirror the change in the repository.

## Formatting notes

- Callout boxes use BookStack's HTML classes inside Markdown: `<p class="callout info|success|warning|danger">…</p>`. Markdown formatting doesn't work inside these; use `<strong>` and `<em>`.
- Tables, fenced code blocks, and task lists (`- [ ]`) are supported.
- Refer to other pages by name in *italics*, for example *Managing Special Events*, rather than by URL, so references survive re-imports.