Integrations

Next.js Blog

Show your published Nimblo articles as a blog on your own Next.js (App Router) site.

The Next.js Blog integration adds a ready-made blog to your own Next.js (App Router) site: an article list, article pages, tag pages and a sitemap, all on your domain. The ai-agent-search-next-js-blog package reads your published articles, and one command adds the blog to your project.

Integration video

Keep your API key server-side only

Read it from AI_AGENT_SEARCH_API_KEY in Server Components, route handlers or server utilities. Never expose it with a NEXT_PUBLIC_ prefix.

How articles look on your site

Formatting and mobile-friendliness depend on your website's theme and CSS. We deliver semantic content; your theme controls the styling. Learn more

Before you start

  • A Next.js App Router website you can change and deploy again.
  • Node.js 18.17 or newer.
  • The starter blog uses Tailwind CSS classes. If your site does not use Tailwind, you can replace the classes with your own CSS.
  • Either an AI coding tool (Cursor, Claude Code, Bolt, v0 or similar) or a developer who can run a few commands.

Don't write code? Use Blog hosting instead. We publish your articles to a blog on your own domain, with no code.

How to connect

Open Settings > Publishing, find Next.js Blog under Connect Your Website, and click Connect. The wizard has 4 steps.

How the Next.js blog works

Choose who is setting it up: Me, with an AI coding tool or A developer. This decides which instructions you see in step 3.

Your API key

If your website has no API key yet, we create one when you reach this step. Add it to your project's .env.local file and to your hosting provider's settings (usually under Environment variables):

.env.local
AI_AGENT_SEARCH_API_KEY=your_api_key

Your website has one API key. The same key is used by the API, Duda, Lovable and Framer. If you click Regenerate API Key, the old key stops working everywhere it is used.

When you click Continue, we turn on the Next.js Blog for your website. If your newest article is not published yet and no other CMS is connected, we also mark it as published, so it is ready the first time your site builds.

Add the blog to your site

With an AI coding tool: click Copy prompt, paste the prompt into your AI tool inside your website's project, then deploy your site.

As a developer:

  1. Install the package:

    npm install ai-agent-search-next-js-blog
  2. Add the blog pages. This copies the routes, components, sitemap and styles into app/blog (or src/app/blog):

    npx ai-agent-search-next-js-blog init

    Can't run it? Copy node_modules/ai-agent-search-next-js-blog/starter/app/blog into app/blog instead.

  3. Add your API key to .env.local and to your hosting provider:

    .env.local
    AI_AGENT_SEARCH_API_KEY=your_api_key
  4. Allow article images in next.config (the starter renders images with next/image):

    next.config.ts
    import type { NextConfig } from 'next';
    
    const nextConfig: NextConfig = {
      images: { remotePatterns: [{ protocol: 'https', hostname: '*' }] },
    };
    
    export default nextConfig;
  5. Deploy. Your blog lives at /blog.

Check your blog is live

Deploy your website, then click Check my site. The wizard shows the address we check (your-site.com/blog unless you change it in the We're checking this blog field) and the newest article we look for. The check can take a minute.

When we find the article, the wizard shows Your Next.js blog is connected and the Next.js Blog card shows Connected. From then on we find the addresses of new articles on your site automatically.

If we cannot find it, the wizard lists the usual reasons: your latest changes are not deployed yet, or your blog is at a different address. Fix the address in the field and check again. If the newest article has not been released yet, come back once it is. Your API key stays saved.

Environment variables

VariableRequiredPurpose
AI_AGENT_SEARCH_API_KEYYesReads your published articles. Server-side only.
NEXT_PUBLIC_SITE_URLRecommendedYour site's URL, used for absolute sitemap and canonical URLs.
AI_AGENT_SEARCH_API_URLNoOverride the API base (e.g. a staging backend). Defaults to production.

Routes

RouteDescription
/blogPaginated article list
/blog/[slug]Article page with metadata and JSON-LD
/blog/tag/[slug]Tag-filtered list
/blog/sitemap.xmlBlog sitemap

How often your blog updates

Your blog's pages refresh once a day, so a new article can take up to a day to show in the article list. To show it sooner, redeploy your site 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.

Disconnecting

Open the Next.js Blog card and click Delete on the last step. New articles are no longer published to your blog. Articles already on it stay there, and your API key keeps working.

Troubleshooting & FAQ

My site gets a 401 Unauthorized error

The key your site sends does not match a key we know. Check AI_AGENT_SEARCH_API_KEY in .env.local and in your hosting provider, and restart the dev server after editing .env.local. If you regenerated the key in the dashboard, update it in both places. If you point at a non-production backend, set AI_AGENT_SEARCH_API_URL.

The blog shows no articles

Only published articles are shown. Open Blog content and check that the website tied to this key has published articles.

An article page shows "not found"

Your site built that page before the article was published. Redeploy your site.

Images do not load

Add the image host to next.config under images.remotePatterns (see step 3).

New articles are missing from the list

The blog refreshes once a day. Redeploy your site, or add on-demand revalidation to show them sooner.

"Check my site" cannot find my article

Make sure your latest changes are deployed and that the article opens at the address the wizard shows. If your blog is somewhere else, change the address in the We're checking this blog field and check again. The blog must be on your website's domain.