import type { Metadata } from "next"; import Link from "next/link"; import Header from "@/components/Header"; import Footer from "@/components/Footer"; import AppImage from "@/components/ui/AppImage"; import AdImage from "@/components/AdImage"; import { ADS_728X90, shuffle } from "@/lib/ads"; import { searchLegacyArticles } from "@/lib/articles/legacy-source"; export const revalidate = 60; export const metadata: Metadata = { title: "Search — Broadcast Beat", description: "Search Broadcast Beat for broadcast engineering news, gear reviews, show coverage, and technology insights.", alternates: { canonical: "/search" }, }; interface SearchPageProps { searchParams: Promise<{ q?: string }>; } export default async function SearchPage({ searchParams }: SearchPageProps) { const { q } = await searchParams; const query = (q ?? "").trim(); const results = query ? await searchLegacyArticles(query, 5000) : []; return (
Search

{query ? `Results for "${query}"` : "Search Broadcast Beat"}

{query ? `${results.length} article${results.length === 1 ? "" : "s"} found across news, gear, technology, and show coverage.` : "Type in the header search box to find articles."}

{query && results.length === 0 && (

No articles match your search.

Browse all news →
)}
{results.map((article) => { if (!article?.slug) return null; return (
{article.category || "NEWS"}

{article.title || "Untitled"}

{article.excerpt || ""}

By {article.author || "Broadcast Beat"} · {article.readTime || ""}
); })}
{/* In-content 728x90 banner */} {ADS_728X90.length > 0 && (
)}
); }