Created
April 28, 2019 20:02
-
-
Save danilowoz/38e7cc62bc95a6df39fa11275bccfa14 to your computer and use it in GitHub Desktop.
Next and prev post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const BlogPost = ({ data, pageContext }) => { | |
const { markdownRemark } = data | |
const { prev, next } = pageContext | |
return ( | |
<> | |
... | |
{prev && ( | |
<Link to={prev.node.fields.slug}> | |
{"<"} {prev.node.frontmatter.title} | |
</Link> | |
)} | |
{next && ( | |
<Link to={next.node.fields.slug}> | |
{next.node.frontmatter.title} {">"} | |
</Link> | |
)} | |
</> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment