Add various ad placements throughout the website to monetize content

Integrates AdSense for ads on the homepage, article pages, and video pages, including in-feed ads styled as article cards.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 413891e8-d784-4bea-b9f5-91a5a68316b4
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: b587b746-f67b-4539-9958-86999aee56de
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/413891e8-d784-4bea-b9f5-91a5a68316b4/igVW4lQ
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sebastjanartic
2026-02-28 18:01:39 +00:00
parent 5fc28baa45
commit 0f1a0222a0
5 changed files with 117 additions and 6 deletions
+14 -3
View File
@@ -8,6 +8,7 @@ import { Skeleton } from "@/components/ui/skeleton";
import { Button } from "@/components/ui/button";
import Header from "@/components/header";
import Footer from "@/components/footer";
import { ArticleCardAd, SidebarAd, InArticleAd } from "@/components/adsense";
import { useState, useEffect, useCallback } from "react";
function FeaturedSection({ articles }: { articles: Article[] }) {
@@ -251,9 +252,18 @@ export default function Home() {
</div>
) : (
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
{(articles || []).map((article) => (
<ArticleCard key={article.id} article={article} />
))}
{(articles || []).flatMap((article, index) => {
const items = [
<ArticleCard key={article.id} article={article} />,
];
if (index === 1) {
items.push(<ArticleCardAd key="ad-feed-1" />);
}
if (index === 4) {
items.push(<ArticleCardAd key="ad-feed-2" />);
}
return items;
})}
</div>
)}
</div>
@@ -262,6 +272,7 @@ export default function Home() {
{popular && popular.length > 0 && (
<PopularSidebar articles={popular} />
)}
<SidebarAd />
</div>
</div>
</main>