Reposition advertisements to appear between content rows
Remove inline advertisements from article grid rows and insert them as separate, centered ad rows between content rows. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 517dfa7b-26ac-463d-a6e1-a58c6df97188 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 0a4cd013-713f-467d-a11c-38ffb5c466c4 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/517dfa7b-26ac-463d-a6e1-a58c6df97188/nFw7xof Replit-Helium-Checkpoint-Created: true
This commit is contained in:
parent
fdf2c210ab
commit
062a82adb8
BIN
attached_assets/image_1772474306256.png
Normal file
BIN
attached_assets/image_1772474306256.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 254 KiB |
@ -490,22 +490,6 @@ export default function Home() {
|
||||
}
|
||||
}
|
||||
|
||||
const totalRows = items.length / 4;
|
||||
let adCount = 0;
|
||||
const articleOnlyRows: number[] = [];
|
||||
for (let row = 0; row < totalRows; row++) {
|
||||
const rowStart = row * 4;
|
||||
const rowItems = items.slice(rowStart, rowStart + 4);
|
||||
if (rowItems.every((it) => it.type === "article")) {
|
||||
articleOnlyRows.push(row);
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < articleOnlyRows.length && adCount < 4; i += 2) {
|
||||
const row = articleOnlyRows[i];
|
||||
const rowStart = row * 4;
|
||||
items[rowStart] = { type: "ad", key: `ad-${adCount}` };
|
||||
adCount++;
|
||||
}
|
||||
|
||||
return items;
|
||||
}, [shuffled, widgets]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user