---
import Base from "../layouts/Base.astro";
import Header from "./Header.astro";
import Footer from "./Footer.astro";
import ArticleListing from "./ArticleListing.astro";
import { site } from "../data/site";
import { PAGE_SIZE, type Article, type CategoryInfo } from "../lib/articles";
interface Props { items: Article[]; categories: CategoryInfo[]; totalCount: number; activeSlug: string | null; activeName: string | null; currentPage: number; lastPage: number; basePath: string; }
const { items, categories, totalCount, activeSlug, activeName, currentPage, lastPage, basePath } = Astro.props as Props;
const heading = activeName ?? "洞察中心";
const pageSuffix = currentPage > 1 ? `｜第${currentPage}页` : "";
const title = `${heading}${pageSuffix}｜${site.brand.name}`;
const description = activeName ? `智引未来${activeName}分类文章，分享GEO、SMO、AI搜索与品牌内容建设的实用洞察。` : "智引未来洞察中心：关于GEO、SMO、AI搜索可见度与品牌内容资产的持续观察。";
const keywords = [heading, "GEO洞察", "SMO增长", "AI搜索", "品牌内容", site.brand.name];
const pageUrl = new URL(`${basePath}${currentPage > 1 ? `/page/${currentPage}` : ""}/`, Astro.site).href;
const jsonLd = [{ "@context": "https://schema.org", "@type": "CollectionPage", name: heading, description, url: pageUrl, inLanguage: "zh-CN", mainEntity: { "@type": "ItemList", itemListElement: items.map((item, index) => ({ "@type": "ListItem", position: (currentPage - 1) * PAGE_SIZE + index + 1, name: item.data.title, url: new URL(`/articles/${item.id}/`, Astro.site).href })) } }, { "@context": "https://schema.org", "@type": "BreadcrumbList", itemListElement: [{ "@type": "ListItem", position: 1, name: "首页", item: Astro.site?.href }, { "@type": "ListItem", position: 2, name: "洞察中心", item: new URL("/articles/", Astro.site).href }, ...(activeName ? [{ "@type": "ListItem", position: 3, name: activeName, item: pageUrl }] : [])] }];
---
<Base {title} {description} {keywords} {jsonLd}><Header /><main id="main-content"><section class="page-hero article-hero"><div class="page-hero__mesh"></div><div class="container page-hero__inner" data-reveal><div class="breadcrumb"><a href="/">首页</a> / <a href="/articles/">洞察中心</a>{activeName && ` / ${activeName}`}</div><div class="eyebrow"><span></span>AILEAD INSIGHTS</div><h1>{heading}</h1><p>{description}</p></div></section><section class="section-pad section-muted"><div class="container"><ArticleListing {items} {categories} {totalCount} {activeSlug} {currentPage} {lastPage} {basePath} /></div></section></main><Footer /></Base>
