--- import CategoryBadge from './CategoryBadge.astro'; import Author from '@components/AuthorDisplay.astro'; export interface Props { items: any[]; showCount?: boolean; type: 'latest' | 'category' | 'author' | 'tag'; slug?: string; pageInfo?: { hasNextPage: boolean; endCursor: string | null; }; perLoad?: number; } const { items = [], showCount = false, type = 'latest', slug = '', pageInfo = { hasNextPage: false, endCursor: null }, perLoad = 11 } = Astro.props; const loadMoreConfig = { type, slug, perLoad }; function getCoauthorsNames(coauthors: any[]): string { if (!coauthors || coauthors.length === 0) return ''; return coauthors .map((coauthor: any) => { const name = coauthor?.node?.name || coauthor?.name; const nickname = coauthor?.node?.nickname || coauthor?.nickname; return name; // Возвращаем только имя, ссылки будут в шаблоне }) .filter(Boolean) .join(', '); } function shouldBeLarge(index: number): boolean { if (index < 8) return false; return (index - 8) % 11 === 0; } ---

{showCount && items.length > 0 && ( ({items.length}) )}

{items.map((item, index) => { const postUrl = item.uri || `/blog/${item.databaseId}`; const postDate = new Date(item.date); const isLarge = shouldBeLarge(index); return (
{item.featuredImage?.node?.sourceUrl ? ( {item.featuredImage.node.altText ) : (
)} {item.categories?.nodes?.[0] && ( )}
{item.coauthors && item.coauthors.length > 0 && ( )}

); })}
{pageInfo.hasNextPage && (
)}