You have mismatch between filename dynamic key and what you expect in the code.
You return blogSlug
key in getStaticPaths
:
const paths = posts.map(post => ({ params: { blogSlug: post.slug } }));
but your file is named [slug].js
and you expect a slug
key here in getStaticProps
:
const blogSlug = context.params.slug;
It should be consistent, in this case it should be named slug
everywhere.