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.
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:
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.