I am using this pattern for building persistent layouts in Next.js: Persistent Layout Patterns in Next.js
It works fine when your layout doesn't rely on external data.
What to do if you want to build a documentation like page - and in your layout there is a sidebar with sections like Getting Started, Examples, FAQ, About? Ideally I would like to store those sections in a markdown file and generate the layout at the build time.
// markdown file
---
section_1: "Getting Started"
section_2: "Examples"
section_3: "FAQ"
section_4: "About"
---
How to achieve such functionality with Next.JS and getStaticProps?