mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 09:24:46 +00:00
No ads on the homepage; low-profile text-link ads elsewhere (#251)
Some checks are pending
CI / build (push) Waiting to run
Deploy to dev2 / deploy (push) Waiting to run
test / test (push) Waiting to run
Some checks are pending
CI / build (push) Waiting to run
Deploy to dev2 / deploy (push) Waiting to run
test / test (push) Waiting to run
- Homepage: removed the 300x250 ad.network unit, its CSS, its rescan effect and the home-only ad.js tag (the ad.network meta verification tag stays). - Blog index and posts: the single unit is now text_link (AdUnit default), full width with an 8px margin, no centred 300x250 box. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d2cd5ffee3
commit
7171c2cdeb
8 changed files with 8 additions and 51 deletions
|
|
@ -5,7 +5,6 @@ import { renderPageMarkup } from "@/lib/page-markup";
|
||||||
import { pageMetadata, specMetadata } from "@/lib/page-meta";
|
import { pageMetadata, specMetadata } from "@/lib/page-meta";
|
||||||
import { HomeInteractivity } from "@/components/home-interactivity";
|
import { HomeInteractivity } from "@/components/home-interactivity";
|
||||||
import { siteFooterHtml } from "@/lib/site-footer";
|
import { siteFooterHtml } from "@/lib/site-footer";
|
||||||
import Script from "next/script";
|
|
||||||
import { AD_NETWORK_CODE } from "@/lib/ad-network";
|
import { AD_NETWORK_CODE } from "@/lib/ad-network";
|
||||||
|
|
||||||
// The legacy SPA served the same single page for every top-level path and just
|
// The legacy SPA served the same single page for every top-level path and just
|
||||||
|
|
@ -59,7 +58,6 @@ export default async function Page({
|
||||||
<>
|
<>
|
||||||
<div id="app" dangerouslySetInnerHTML={{ __html: renderPageMarkup(slug?.[0] ? `/${slug[0]}` : "/", footer) }} />
|
<div id="app" dangerouslySetInnerHTML={{ __html: renderPageMarkup(slug?.[0] ? `/${slug[0]}` : "/", footer) }} />
|
||||||
<HomeInteractivity />
|
<HomeInteractivity />
|
||||||
{!slug?.length && <Script src="https://crawlproof.com/ad.js" strategy="afterInteractive" />}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,9 +145,7 @@ export default async function BlogPostPage({
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: "flex", justifyContent: "center", marginBottom: "2rem" }}>
|
<AdUnit slot="709f4f1d-667a-4888-9040-90f5f65120f2" />
|
||||||
<AdUnit slot="709f4f1d-667a-4888-9040-90f5f65120f2" format="banner_300x250" />
|
|
||||||
</div>
|
|
||||||
{post.featured_image?.url ? (
|
{post.featured_image?.url ? (
|
||||||
// eslint-disable-next-line @next/next/no-img-element
|
// eslint-disable-next-line @next/next/no-img-element
|
||||||
<img
|
<img
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,7 @@ export default async function BlogIndex(): Promise<ReactNode> {
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: "flex", justifyContent: "center", marginBottom: "2rem" }}>
|
<AdUnit slot="709f4f1d-667a-4888-9040-90f5f65120f2" />
|
||||||
<AdUnit slot="709f4f1d-667a-4888-9040-90f5f65120f2" format="banner_300x250" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{posts.length === 0 ? (
|
{posts.length === 0 ? (
|
||||||
<p style={{ color: "#5b6b7a" }}>No posts yet.</p>
|
<p style={{ color: "#5b6b7a" }}>No posts yet.</p>
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,20 @@
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import Script from "next/script";
|
import Script from "next/script";
|
||||||
|
|
||||||
// CrawlProof ad unit, scoped to the pages that render it (currently /blog/*).
|
// CrawlProof ad unit, scoped to the pages that render it (currently /blog/*):
|
||||||
|
// the low-profile 40px text_link line, one per page, never on the home page.
|
||||||
// The loader is deduped by src, so mounting <AdUnit /> on multiple routes only
|
// The loader is deduped by src, so mounting <AdUnit /> on multiple routes only
|
||||||
// injects one https://crawlproof.com/ad.js.
|
// injects one https://crawlproof.com/ad.js.
|
||||||
export function AdUnit({
|
export function AdUnit({
|
||||||
slot,
|
slot,
|
||||||
format = "banner_300x250",
|
format = "text_link",
|
||||||
}: {
|
}: {
|
||||||
slot: string;
|
slot: string;
|
||||||
format?: string;
|
format?: string;
|
||||||
}): ReactNode {
|
}): ReactNode {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div data-cp-ad data-slot={slot} data-format={format} />
|
<div data-cp-ad data-slot={slot} data-format={format} style={{ width: "100%", margin: "8px 0" }} />
|
||||||
<Script src="https://crawlproof.com/ad.js" strategy="afterInteractive" />
|
<Script src="https://crawlproof.com/ad.js" strategy="afterInteractive" />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -115,22 +115,5 @@ export function HomeInteractivity(): null {
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// The home page ad.network unit lives in the server-rendered markup, and
|
|
||||||
// crawlproof's ad.js scans once at DOMContentLoaded. A client-side visit to
|
|
||||||
// "/" (from /blog, say) re-renders the markup after that scan, so ask the
|
|
||||||
// loader to scan again, retrying briefly while the script is still loading.
|
|
||||||
useEffect(() => {
|
|
||||||
if (!document.querySelector("[data-ad-network]")) return;
|
|
||||||
let tries = 0;
|
|
||||||
const timer = window.setInterval(() => {
|
|
||||||
const ads = (window as { crawlproofAds?: { scan?: () => void } }).crawlproofAds;
|
|
||||||
if (ads?.scan || ++tries >= 20) {
|
|
||||||
window.clearInterval(timer);
|
|
||||||
ads?.scan?.();
|
|
||||||
}
|
|
||||||
}, 250);
|
|
||||||
return () => window.clearInterval(timer);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,5 @@
|
||||||
// ad.network publisher claim for logicsrc.com. The <meta name="ad.network">
|
// ad.network publisher claim for logicsrc.com. The <meta name="ad.network">
|
||||||
// tag (home page metadata) lets ad.network verify ownership from the
|
// tag (home page metadata) lets ad.network verify ownership from the
|
||||||
// server-rendered HTML; the aside is the home page unit, filled in place by
|
// server-rendered HTML. The home page carries no ad unit; blog pages keep their
|
||||||
// crawlproof.com/ad.js. Blog pages keep their own CrawlProof slot (AdUnit).
|
// own CrawlProof slot (AdUnit).
|
||||||
export const AD_NETWORK_CODE = "xPEOavNsIGrivkMw";
|
export const AD_NETWORK_CODE = "xPEOavNsIGrivkMw";
|
||||||
export const HOME_AD_SLOT = "efda46e1-bbc3-42e7-8fd0-2640bdd8a90f";
|
|
||||||
|
|
||||||
/** The home page unit, placed between the hero and the first band. */
|
|
||||||
export function renderHomeAdHtml(): string {
|
|
||||||
return `<aside class="home-ad" data-ad-network="${AD_NETWORK_CODE}" data-cp-ad data-slot="${HOME_AD_SLOT}" data-format="banner_300x250"></aside>`;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import { renderInstallCommand } from "./install-command";
|
||||||
import { renderNavHtml } from "./nav";
|
import { renderNavHtml } from "./nav";
|
||||||
import { renderCrumbsHtml } from "./crumbs";
|
import { renderCrumbsHtml } from "./crumbs";
|
||||||
import { FAMILIES, familyTree } from "./specs";
|
import { FAMILIES, familyTree } from "./specs";
|
||||||
import { renderHomeAdHtml } from "./ad-network";
|
|
||||||
|
|
||||||
const schemas = [
|
const schemas = [
|
||||||
{ name: "logicsrc-task", path: "packages/schemas/schemas/logicsrc-task.schema.json" },
|
{ name: "logicsrc-task", path: "packages/schemas/schemas/logicsrc-task.schema.json" },
|
||||||
|
|
@ -149,7 +148,6 @@ export function renderPageMarkup(path = "/", footer = ""): string {
|
||||||
<span><strong>3</strong>reference plugins</span>
|
<span><strong>3</strong>reference plugins</span>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
${path === "/" ? renderHomeAdHtml() : ""}
|
|
||||||
|
|
||||||
<section class="band">
|
<section class="band">
|
||||||
<div class="section-head">
|
<div class="section-head">
|
||||||
|
|
|
||||||
|
|
@ -1004,16 +1004,3 @@ pre {
|
||||||
color: #101418;
|
color: #101418;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Home page ad.network unit: collapsed until crawlproof's ad.js fills it. */
|
|
||||||
.home-ad {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
height: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.home-ad[data-cp-filled] {
|
|
||||||
height: auto;
|
|
||||||
min-height: 266px;
|
|
||||||
margin: 8px 0 24px;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue