Integrating NeetoPublish with Next.js

NeetoPublish allows you to connect your blog posts to a Next.js application. Here's a step-by-step guide to get started:

Setup Steps

  1. Create a NeetoPublish Workspace

    • Sign up at NeetoPublish and create a new workspace

    • Create blog posts in your workspace and publish them

    • You can refer to the NeetoPublish documentation for detailed setup instructions

  2. Get API Key

    • Navigate to your workspace settings

    • Go to General > API Keys section

    • Create a new API key if needed

    • Copy and securely store your API key

  3. Access APIs

    • Use the provided Postman collection to explore available endpoints

    • Add your API key as an authentication header

Integration Options

  1. Static Site Generation (SSG)

    • Set up getStaticProps in your Next.js pages to fetch blog data during build time

    • Create an API endpoint in your Next.js app for handling revalidation

    • Implement Next.js On-Demand Revalidation to update content without rebuilding

  2. Server-Side Rendering (SSR)

    • Use getServerSideProps to fetch blog data on each request

    • Make direct API calls to NeetoPublish endpoints

    • Content updates will be reflected immediately on the next page load

Webhook Setup (for SSG only)

  1. Configure webhooks in NeetoPublish

    • Go to workspace settings

    • Add your Next.js application's revalidation endpoint URL

    • Save the webhook secret key provided

  2. Create an API endpoint in Next.js

    • Create a new API route for handling webhook requests

    • Implement logic to trigger revalidation for updated content

    • Example path: /api/revalidate

  3. Implement Security

    • Add webhook secret key verification in your API endpoint

    • Validate incoming requests to ensure they're from NeetoPublish

    • Return appropriate success/error responses

When you publish new content in NeetoPublish, it automatically triggers your webhook, which calls your Next.js API endpoint to revalidate the build, ensuring your site stays up to date.

Can't find what you're looking for?