Open-source SEO, GEO, and marketing skills for AI agents.
notfair-nextjs-blog 0.2.0: rebrand to NotFair SEO
Yuting Zhongd84717877667
diff --git a/notfair-nextjs-blog/README.md b/notfair-nextjs-blog/README.mdindex 6d1dc7a0..861b4ec2 100644--- a/notfair-nextjs-blog/README.md+++ b/notfair-nextjs-blog/README.md@@ -1,6 +1,6 @@# notfair-nextjs-blog-Render your [NotFair Backlinks](https://notfair.co/backlinks) exchange posts on+Render your [NotFair SEO](https://notfair.co/seo) exchange posts ona Next.js (App Router) blog. Pull model: your site fetches published postsserver-side from the NotFair content API with a private key — nothing is everpushed to your infrastructure.@@ -13,12 +13,12 @@ pushed to your infrastructure.npm install notfair-nextjs-blog```-2. In the NotFair Backlinks dashboard, create a **Next.js / headless**+2. In the NotFair SEO dashboard, create a **Next.js / headless**integration and copy the site API key (shown once).3. Add it to your environment — server-side only, never `NEXT_PUBLIC_`:```bash-NOTFAIR_BACKLINKS_API_KEY=nfbl_...+NOTFAIR_SEO_API_KEY=nfbl_...```4. Set your integration's **public post URL pattern** to where these pages@@ -31,10 +31,10 @@ NOTFAIR_BACKLINKS_API_KEY=nfbl_...```tsximport Link from "next/link";-import { getBacklinksPosts } from "notfair-nextjs-blog";+import { getSeoPosts } from "notfair-nextjs-blog";export default async function BlogIndex() {- const posts = await getBacklinksPosts();+ const posts = await getSeoPosts();return (<main><h1>Blog</h1>@@ -52,7 +52,7 @@ export default async function BlogIndex() {```tsximport { notFound } from "next/navigation";-import { getBacklinksPost } from "notfair-nextjs-blog";+import { getSeoPost } from "notfair-nextjs-blog";export default async function BlogPost({params,@@ -60,7 +60,7 @@ export default async function BlogPost({params: Promise<{ slug: string }>;}) {const { slug } = await params;- const post = await getBacklinksPost(slug);+ const post = await getSeoPost(slug);if (!post) notFound();return (<article>@@ -75,5 +75,5 @@ Responses revalidate hourly by default (`{ revalidate }` option to change).## API-- `getBacklinksPosts({ revalidate? })` → `[{ id, title, slug, published_at, created_at }]`-- `getBacklinksPost(slug, { revalidate? })` → adds `content_html`, or `null`+- `getSeoPosts({ revalidate? })` → `[{ id, title, slug, published_at, created_at }]`+- `getSeoPost(slug, { revalidate? })` → adds `content_html`, or `null`diff --git a/notfair-nextjs-blog/package.json b/notfair-nextjs-blog/package.jsonindex a87d98c6..a19f73f1 100644--- a/notfair-nextjs-blog/package.json+++ b/notfair-nextjs-blog/package.json@@ -1,7 +1,7 @@{"name": "notfair-nextjs-blog",- "version": "0.1.0",- "description": "Render your NotFair Backlinks exchange posts on a Next.js blog — server-side content pulls with your private site API key.",+ "version": "0.2.0",+ "description": "Render your NotFair SEO exchange posts on a Next.js blog — server-side content pulls with your private site API key.","license": "MIT","type": "module","main": "dist/index.js",diff --git a/notfair-nextjs-blog/src/index.ts b/notfair-nextjs-blog/src/index.tsindex fc9f80b8..d3ff43a8 100644--- a/notfair-nextjs-blog/src/index.ts+++ b/notfair-nextjs-blog/src/index.ts@@ -1,29 +1,34 @@/**- * notfair-nextjs-blog — server-side client for the NotFair Backlinks+ * notfair-nextjs-blog — server-side client for the NotFair SEO* content API (the "Next.js / headless" integration).*- * Usage: set NOTFAIR_BACKLINKS_API_KEY in your environment (server-only —+ * Usage: set NOTFAIR_SEO_API_KEY in your environment (server-only —* never expose it to the client bundle), then call these from Server* Components or route handlers. See README.md for a copy-paste app/blog.*/-const API_BASE = process.env.NOTFAIR_BACKLINKS_API_URL ?? "https://notfair.co/api/backlinks/content";+const API_BASE = process.env.NOTFAIR_SEO_API_URL ?? "https://notfair.co/api/seo/content";-export type BacklinksPostSummary = {+export type SeoPostSummary = {id: number;title: string;slug: string;+ meta_description: string | null;+ tags: string[];+ /** Generated title-card image (1200×630) — thumbnail / og:image. */+ image_url: string;+ reading_time_minutes: number | null;published_at: string | null;created_at: string;};-export type BacklinksPost = BacklinksPostSummary & { content_html: string };+export type SeoPost = SeoPostSummary & { content_html: string };function apiKey(): string {- const key = process.env.NOTFAIR_BACKLINKS_API_KEY;+ const key = process.env.NOTFAIR_SEO_API_KEY;if (!key) {throw new Error(- "notfair-nextjs-blog: NOTFAIR_BACKLINKS_API_KEY is not set. Create the key in your NotFair Backlinks dashboard (Integrations → Next.js).",+ "notfair-nextjs-blog: NOTFAIR_SEO_API_KEY is not set. Create the key in your NotFair SEO dashboard (Integrations → Next.js).",);}return key;@@ -43,23 +48,23 @@ async function contentFetch(path: string, revalidate: number): Promise<Response>}/** List published exchange posts (no bodies — cheap for blog indexes). */-export async function getBacklinksPosts(+export async function getSeoPosts(opts: { revalidate?: number } = {},-): Promise<BacklinksPostSummary[]> {+): Promise<SeoPostSummary[]> {const res = await contentFetch("", opts.revalidate ?? 3600);if (!res.ok) return [];- const body = (await res.json().catch(() => null)) as { posts?: BacklinksPostSummary[] } | null;+ const body = (await res.json().catch(() => null)) as { posts?: SeoPostSummary[] } | null;return body?.posts ?? [];}/** Fetch one published post with its full HTML body. Returns null if the* slug doesn't exist or isn't published. */-export async function getBacklinksPost(+export async function getSeoPost(slug: string,opts: { revalidate?: number } = {},-): Promise<BacklinksPost | null> {+): Promise<SeoPost | null> {const res = await contentFetch(`?slug=${encodeURIComponent(slug)}`, opts.revalidate ?? 3600);if (!res.ok) return null;- const body = (await res.json().catch(() => null)) as { post?: BacklinksPost } | null;+ const body = (await res.json().catch(() => null)) as { post?: SeoPost } | null;return body?.post ?? null;}