Alternate ad placement in article rows

Modify the home page component to alternate the placement of ads within rows that do not contain widgets, placing them at the start or end of the row.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 1f7e7e89-a520-4970-9645-37daadc466dc
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 044378c9-4df0-4f89-848d-3fd628baf954
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/1f7e7e89-a520-4970-9645-37daadc466dc/NJvOVoB
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sebastjanartic 2026-03-05 12:28:04 +00:00
parent 2d258f1523
commit d7dec588b6

View File

@ -554,7 +554,8 @@ export default function Home() {
const rowStart = r * 4;
const hasWidget = items.slice(rowStart, rowStart + 4).some((it) => it.type === "widget");
if (!hasWidget) {
items[rowStart + 3] = { type: "ad", key: `ad-row-${adCount++}` };
const pos = adCount % 2 === 0 ? 0 : 3;
items[rowStart + pos] = { type: "ad", key: `ad-row-${adCount++}` };
}
}