title: How to implement Previous Post & Next Post in a Next JS Blog?
body: <p>I want to go to the previous post &amp; next post from a particular blog post.</p>
  
  <p>Consider, this Gatsby example - <a href="https://gatsby-starter-blog-demo.netlify.com/my-second-post/" rel="nofollow noreferrer">https://gatsby-starter-blog-demo.netlify.com/my-second-post/</a></p>
  
  <p>It has 2 links at the bottom of the page - </p>
  
  <p><strong>← Hello World</strong> which is a Previous Post &amp; <strong>New Beginnings →</strong> which is a Next Post</p>
  
  <p>To use this dynamically, I need to access slug of the post but how would I get that? It's simple in Gatsby due to the use of GraphQL.</p>
  
  <p>But, in Next, I have to use <a href="https://github.com/johnlindquist/next-mdx-blog/blob/master/pages/index.js#L3" rel="nofollow noreferrer">preval hack</a> only to get posts. How will I get slugs so that I can implement Previous and Next Post in my particular blog?</p>
  
  <p>Even <a href="https://nextjs.org/blog/" rel="nofollow noreferrer">Next JS's own blog</a> does not have Next Post and Previous Post links.</p>
  
  <p>Check out <a href="https://nextjs.org/blog/webpack-memory/" rel="nofollow noreferrer">any post on Next JS's Blog</a> and you will find a <strong>Back to Blog</strong> button but no previous post or next post button.</p>