← All workCase study · Website

Barboursville Vineyards

A headless WordPress site for a winery in Virginia, with wines, events, tours, the restaurant and notes from the winemaker. Editors build pages in WordPress and choose their template.

Role
Sole frontend developer at PixelCrew
Timeline
Oct 2023 – 2024, maintenance to 2026
Team
PixelCrew
Live
bbvwine.com

Problem

Barboursville is a winery in Virginia, and its old site ran on a classic WordPress theme. We kept WordPress for the rebuild, since the editors already knew it, and moved the frontend to Next.js. They still write pages, events, wines and news in the same admin.

The site covers the estate’s history, culture and sustainability, the wines, a monthly calendar of events, tours and tastings, the restaurant and the newsletter. The shop and the reservations are external services that the site links to.

Architecture

Next.js reads WordPress on the server through custom REST endpoints that return ACF fields and Yoast data. Pages are pre-rendered and refreshed every 45 seconds. Forms post to Gravity Forms, and the sitemap is built from what’s in WordPress. Sentry tracks errors; GTM handles analytics.

The Next.js site reads WordPress REST on the server and refreshes static pages every 45 seconds. Forms go to Gravity Forms.Next.js sitecatch-all route · 18 templatesstatic pages, ISR 45 sWordPressREST · ACF · Yoastused by the editorsGravity Formscontact · newsletterevery 45 sform submitSitemap · metadatafrom CMS content and YoastSentry · GTMerrors · analyticsShop · bookingsexternal, linkedbuilt by meowned by others
I built the Next.js frontend and its 18 templates. WordPress and its content belong to PixelCrew and the client's editors; the shop and the reservations are external services.

Scope

Mine

  • The whole frontend: the 18 templates, navigation, filters and forms
  • Routing driven by the content in WordPress
  • SEO metadata and the sitemap, generated from the CMS

Other teams

  • WordPress setup and content (PixelCrew and the client’s editors)
  • Shop and reservations (external services)

Key decisions

One catch-all route, with the template chosen in WordPress

Why. Editors had to be able to create pages without me. So there is a single route. It looks up the URL among the pages in WordPress, reads its type (page, post, event, wine) and the template the editor picked, then renders the matching component.

Trade-off. All the routing sits in one file of about 400 lines.

Static pages, refreshed every 45 seconds

Why. Pages are served as static files, and a change in WordPress still goes live without a webhook or a rebuild.

Trade-off. An editor can wait up to 45 seconds before the change shows up.

SEO managed in Yoast

Why. The editors already used Yoast, so I turn its output into Next.js metadata and JSON-LD. Titles, descriptions and social previews stay theirs to edit.

Trade-off. If Yoast changes the shape of its output, the frontend has to follow.

In code

The catch-all route, with most of the templates left out:

app/[[...slug]]/page.tsxillustrative
export default async function Page({ params }: PageProps) {
  // Every published URL in WordPress, with its type
  const pages = await getRoutes();
  const current = pages.find((p) => samePath(p.slug, params.slug));
  if (!current) notFound();

  if (current.type === "event") return <EventTemplate pages={pages} />;
  if (current.type === "wine" || current.type === "wine-category") {
    return <WinesLayout pages={pages} slugs={params.slug} />;
  }

  const page = await getPage(params.slug.at(-1));

  // The template is chosen by the editor in WordPress
  switch (page.template) {
    case "controllers/page-heritage.php":
      return <HeritagePageTemplate data={page} />;
    case "controllers/page-restaurant.php":
      return <RestaurantPageTemplate data={page} />;
    // …16 more templates
  }
}

Results

18
page templates the editors choose from WordPress
6
content types managed in the CMS
45 s
for a content change to reach the live site, with no rebuild

Editors still create pages and pick their templates without a developer. The site went live in 2024, and I looked after it until 2026.