diff --git a/client/src/pages/home.tsx b/client/src/pages/home.tsx index 8c59d42..8d59655 100644 --- a/client/src/pages/home.tsx +++ b/client/src/pages/home.tsx @@ -491,17 +491,17 @@ export default function Home() { } const totalRows = items.length / 4; + const adTargetRows = [1, 3, 5, 7]; let adCount = 0; - for (let row = 0; row < totalRows && adCount < 4; row++) { + for (const row of adTargetRows) { + if (row >= totalRows) continue; const rowStart = row * 4; const rowItems = items.slice(rowStart, rowStart + 4); - const hasWidget = rowItems.some((it) => it.type === "widget"); - if (hasWidget) continue; const articleIndices = rowItems .map((it, ci) => (it.type === "article" ? ci : -1)) .filter((ci) => ci >= 0); if (articleIndices.length > 0) { - const col = articleIndices[adCount % articleIndices.length]; + const col = articleIndices[0]; items[rowStart + col] = { type: "ad", key: `ad-${adCount}` }; adCount++; }