NextJs
  • 11 Mar 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

NextJs

  • Dark
    Light
  • PDF

Article Summary

This guide provides all the necessary information for integrating Prerender into your NextJS project to boost your ranking on search result pages.

Video guide:

Text guide: 

  1.  Copy the Integration's source code from here to your NextJS project's root directory. Make sure to name the file middleware.js.  
  2. Add your Prerender token to the middleware.js file's source code.
    1. You can add the Prerender token to the integration's source code by replacing process.env.PRERENDER_TOKEN with your token from the dashboard.
    2.  Alternatively, you can also add your Prerender token as an environment variable. In this case, the name of the environment variable must be PRERENDER_TOKEN.
           The exact method depends on your setup. For example, In Vercel, you can add it from the Project Settings menu under the Environment variables settings.
       
  3.  Push and commit your changes after the new version is deployed the integration should work. 
  4. Test your integration based on this guide




Was this article helpful?

What's Next