Reputation: 463
I'm working on a project in Next.js where I have to display a bullet list from an array in frontmatter.
I managed to display the list, but the bullets are empty. How can I fix this?
This is my code:
Template.js:
{frontMatter.arrays.map(({ array }) => (
<li>{array}</li>
))}
page.mdx:
arrays:
- Content 1
- Content 2
Result:
Upvotes: 0
Views: 2205
Reputation: 762
Write your array like this in your frontmatter
arrays: ['item1', 'item2']
then to get the values:
{arrays && arrays.map((z) => (
<p>{z}</p>
))}
Upvotes: 1