cross-link: forum auto-link, NAB hub, sponsor strip, recent stories

Feature 3 — forum auto-linking
  Thread + reply bodies in /forum/thread/[id] now wrap company-name
  mentions with /manufacturers/<slug> links via a new client-side
  LinkifyPlainText component. Loads the directory list once per page
  (module-level promise cache), regex-scans each body, preserves
  whitespace, caps at 10 links per body to avoid clutter.
  CompanyMentionsHover mounted on the page so the same preview card
  pops on hover.
  Adds /api/public/companies/list — minimal { name, slug } directory
  feed, cached 10min.

Feature 4 — /nab-2026 live coverage hub
  New page aggregating every directory company with exhibits_nab=true.
  Three sections:
    - Coverage Partners — active advertisers exhibiting at NAB, larger
      tiles with emerald Sponsor border
    - Latest from the show floor — last 60 days of articles with NAB
      in the title, cinematic grid
    - All NAB 2026 exhibitors — alphabetical, capped at 200 with link
      to full /manufacturers directory
  Every company tile carries data-company-slug for hover previews.

Feature 5b — Sponsor logo strip on homepage
  New SponsorLogoStrip server component renders just above the footer
  on the homepage, showing logos of every current banner advertiser
  with a directory entry + logo. Each links to the manufacturer
  profile with the hover-card slug attribute.

Feature 5c — Recent coverage on manufacturer profiles
  /manufacturers/[slug] now includes a grid of the 6 most recent
  articles matching the company name in the title, with thumbnails.
  Renames the existing manufacturer_id-linked block to "Press
  releases" since it's a separate data source.
This commit is contained in:
Ryan Salazar
2026-05-27 12:55:25 +00:00
parent a59846a524
commit 2e78726291
7 changed files with 552 additions and 4 deletions

View File

@@ -41,11 +41,28 @@ async function loadManufacturer(slug: string) {
.order("sort_order")
.order("name");
// Recent stories: title contains the company name. The same heuristic the
// article auto-linker and the hover card use — keeps the directory in sync
// with the editorial coverage even when manufacturer_id isn't backfilled.
const needle = String(data.company_name || "").trim();
let recentStories: any[] = [];
if (needle.length >= 3) {
const { data: stories } = await supabase
.from("wp_imported_posts")
.select("wp_slug, title, excerpt, featured_image, wp_published_at, category")
.eq("status", "published")
.ilike("title", `%${needle.replace(/[%_]/g, "")}%`)
.order("wp_published_at", { ascending: false, nullsFirst: false })
.limit(12);
recentStories = stories || [];
}
return {
company: data,
shows: shows || [],
pressReleases: pressReleases || [],
executives: executives || [],
recentStories,
};
}
@@ -86,7 +103,7 @@ export default async function ManufacturerProfile({
const { slug } = await params;
const result = await loadManufacturer(slug);
if (!result) notFound();
const { company, shows, pressReleases, executives } = result;
const { company, shows, pressReleases, executives, recentStories } = result;
const jsonLd = {
"@context": "https://schema.org",
@@ -339,9 +356,46 @@ export default async function ManufacturerProfile({
</section>
)}
{recentStories.length > 0 && (
<section className="mb-10">
<header className="flex items-baseline justify-between mb-3">
<h2 className="text-lg font-display font-bold text-ink">Recent coverage</h2>
<Link href={`/news?search=${encodeURIComponent(company.company_name)}`} className="text-xs text-brand-primary hover:underline">
All stories
</Link>
</header>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3">
{recentStories.slice(0, 6).map((r: any) => (
<Link
key={r.wp_slug}
href={`/news/${r.wp_slug}`}
className="group bg-white border border-ink/10 rounded-md p-3 hover:border-brand-primary hover:shadow-sm transition-all flex gap-3"
>
{r.featured_image ? (
/* eslint-disable-next-line @next/next/no-img-element */
<img src={r.featured_image} alt="" className="w-20 h-14 rounded object-cover bg-ink/5 flex-shrink-0" loading="lazy" />
) : (
<div className="w-20 h-14 rounded bg-ink/5 flex-shrink-0" />
)}
<div className="min-w-0">
<h3 className="text-xs font-semibold text-ink leading-snug group-hover:text-brand-primary line-clamp-3">
{r.title}
</h3>
{r.wp_published_at && (
<p className="text-[10px] text-ink/50 mt-1">
{new Date(r.wp_published_at).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}
</p>
)}
</div>
</Link>
))}
</div>
</section>
)}
{pressReleases.length > 0 && (
<section className="mb-10">
<h2 className="text-lg font-display font-bold text-ink mb-3">Recent news</h2>
<h2 className="text-lg font-display font-bold text-ink mb-3">Press releases</h2>
<ul className="space-y-2">
{pressReleases.map((p) => (
<li key={p.slug || p.source_url} className="text-sm">