Next.js Blog
Render your published BabyLoveGrowth articles as a blog on your own Next.js (App Router) site.
Read your published BabyLoveGrowth articles server-side and render them as a blog on your own Next.js (App Router) site — article lists, article pages, tag pages, and a sitemap, all on your own domain. The babylovegrowth-next-js-blog package is the read client; one scaffold command drops in a ready-made app/blog.
Integration Video
Keep your API key server-side only. Read it from
BABYLOVEGROWTH_BLOG_API_KEY in Server Components, route handlers, or server
utilities. Never expose it with a NEXT_PUBLIC_ prefix.
Requirements
- Node.js 18.17+
- A Next.js App Router project (the starter uses Tailwind CSS classes)
Setup
-
Get your API key. In Settings → Integrations → Next.js Blog, click Connect, then add the key to
.env.local:BABYLOVEGROWTH_BLOG_API_KEY=your_api_key -
Install the package in your Next.js project:
npm install babylovegrowth-next-js-blog -
Scaffold the blog — copies the routes, components, sitemap, and styles into
app/blog(orsrc/app/blog):npx babylovegrowth-next-js-blog init -
Allow your article image host in
next.config.js(the starter renders images withnext/image):// next.config.ts import type { NextConfig } from 'next'; const nextConfig: NextConfig = { images: { remotePatterns: [{ protocol: 'https', hostname: '*' }] }, }; export default nextConfig; -
Run it:
npm run dev, then open/blog.
Environment variables
| Variable | Required | Purpose |
|---|---|---|
BABYLOVEGROWTH_BLOG_API_KEY | Yes | Reads your published articles. Server-side only. |
NEXT_PUBLIC_SITE_URL | Recommended | Your site's URL — used for absolute sitemap and canonical URLs. |
BABYLOVEGROWTH_BLOG_API_URL | No | Override the API base (e.g. a staging backend). Defaults to production. |
Routes
| Route | Description |
|---|---|
/blog | Paginated article list |
/blog/[slug] | Article page with metadata and JSON-LD |
/blog/tag/[slug] | Tag-filtered list |
/blog/sitemap.xml | Blog sitemap |
Caching
Blog data uses ISR: it revalidates once per day in production, and changes appear quickly in development. New or updated articles can take up to a day to show unless you redeploy or add on-demand revalidation.
Sitemap
Submit /blog/sitemap.xml in Google Search Console, or merge it into your site's main sitemap. Set NEXT_PUBLIC_SITE_URL so its URLs are absolute.
Troubleshooting
- 401 Unauthorized — the key doesn't match the API it's calling. Check
BABYLOVEGROWTH_BLOG_API_KEY, and restart the dev server after editing.env.local. If you point at a non-production backend, setBABYLOVEGROWTH_BLOG_API_URL. - No articles — only published articles are returned. Confirm the website tied to this key has published articles.
- Images don't load — add the image host to
next.config.jsunderimages.remotePatterns. - New articles missing — that's the daily ISR cache; redeploy or add on-demand revalidation.
Prefer a no-code option? Use Blog Hosting to host your blog on a subdomain with one DNS record.