Add a DropInBlog Blog to a Next.js App
DropInBlog’s two Next.js packages and their installer add a complete, server-rendered blog to your app. The setup takes a few minutes, gives each post, author, and category a route in your app, and generates a sitemap and RSS feed in there too.
How to Install DropInBlog on Next.js
The setup has four parts: installing the packages, adding your credentials, installing the blog routes, and verifying the connection.
Install the Packages
- Open a terminal in your Next.js project folder.
- Run this command:
npm install @dropinblog/react-nextjs @dropinblog/react-core
Add Your API Key and Blog ID
- In your DropInBlog account, go to API Keys.
- Click Add API Key to generate one for your blog, and copy it.
- Under the API Keys section, look for Blog IDs and copy your blog ID.
- In your project’s root folder, create a file named
.env.local. - Add these two lines, replacing the placeholder values with the blog ID and API key you copied:
DROPINBLOG_BLOG_ID=your_blog_id_here
DROPINBLOG_API_KEY=your_api_key_here
Install the Blog Routes
- Run the installer for your router:
- App Router:
npx dropinblog-nextjs install --router app - Pages Router:
npx dropinblog-nextjs install --router pages
The installer adds these routes to your app:
/blog: the main list of posts/blog/page/\[page]: paginated list of posts/blog/\[slug]: a single post/blog/category/\[slug]: posts in one category/blog/category/\[slug]/page/\[page]: paginated category pages/blog/author/\[slug]: posts by one author/blog/author/\[slug]/page/\[page]: paginated author pages/blog/sitemap.xml: the blog sitemap/blog/feed: the RSS feed for all posts/blog/feed/category/\[slug]and/blog/feed/author/\[slug]: RSS feeds for one category or author
Verify the Connection
- Run npm run dev in your terminal to start your Next.js project locally.
- Open
http://localhost:3000/blogto check that the blog loads. - Deploy your app the way you normally do, and copy your blog’s URL from the live site (for example,
your-domain-name/blog). - On the Code & Layout page in DropInBlog, click Verify Integration. If you’re asked for a URL, paste your blog’s URL. You’ll see a message that your blog is live.
Where Your Next.js Blog Lives
Your posts are stored in DropInBlog, and your Next.js app serves the blog pages. The packages fetch each blog post from DropInBlog as ready-made HTML and render it on the server, so once you deploy, the blog is part of your own site at /blog. Before that, you’ll only see it locally at http://localhost:3000/blog. Its main URLs look like this:
your-domain-name/blogyour-domain-name/blog/blog-post-title
Verifying the Integration
Publish a test post to confirm your content displays properly:
- Open the Posts page.
- Click Add Blog Post.
- Add your content, including at least one image and one link.
- Select the Published option under Status and click Save Post.
- Click View Post.
- Check that the post appears at
your-domain-name/blog/blog-post-title, with its text, image, and link in place.
Styling
A DropInBlog-powered blog picks up the design of your Next.js site, so it should fit in without extra styling. You can change the inherited design and add custom CSS from the Code & Layout page of your DropInBlog account:
- To change the inherited styles, go to Design → Design Customizations.
- To apply your own CSS, use Custom CSS in the Advanced Options section below Design.
Troubleshooting
If your blog isn’t showing up, check these first:
- Make sure you installed both required packages. You need both
@dropinblog/react-nextjsand@dropinblog/react-core. If you skipped one, run the command again:npm install @dropinblog/react-nextjs @dropinblog/react-core. - Check that your blog ID and API key are correct. Compare the values in the
.env.localfile against the values on the API Keys page of your DropInBlog account. - Check that
.env.localis in your project’s root folder. If your project uses asrcfolder, keep.env.localin the root, not insidesrc. Next.js only loads it from the root. - Check that you ran the installation commands from your Next.js project root folder. Open a terminal where package.json lives and run them again.
- Check that you restarted the dev server after editing
.env.local. Stop the server and runnpm run devagain. - Make sure you used the correct router flag. Check whether the project uses
app/orpages/and rerun the installer with the matching--routervalue. - If the blog works locally but not on your live site, check your host’s environment variables.
.env.localusually isn’t committed to your repository, so your deployed app doesn’t see it. AddDROPINBLOG_BLOG_IDandDROPINBLOG_API_KEYin your hosting provider’s environment variable settings, then redeploy.
If none of this helps, contact DropInBlog support and include a link to your blog page.
Limitations
The blog runs inside your app, with a couple of things to keep in mind:
- Your app’s main sitemap doesn’t list your blog posts. The installer creates a separate sitemap for the blog. Solved: submit
your-domain-name/blog/sitemap.xmlto Google Search Console alongside your main sitemap. - DropInBlog can’t be used to create an entire Next.js application. DropInBlog provides the blogging layer, while the rest of the application is still built and maintained in Next.js.
Updated on: 07/10/2026