DEV Community

Discussion on: Svelte + Sapper + Netlify CMS

Collapse
 
avcohen profile image
Aaron Cohen • Edited

Thanks so much for noting these! I made edits to the post to reflect these corrections 👍

Collapse
 
triptych profile image
Andrew Wooldridge

That's actually wrong --> this line breaks things :
const { data, content } = grayMatter(post).data;
because grayMatter(post) is returning:
{ content: 'Testing',
data: { slug: 'test', title: 'Test' },
isEmpty: false,
excerpt: '',
orig:
0d 0a 54 65 73 74 69 6e 67> }
so if you tell it to just return greyMatter(post).data then content never gets defined

Thread Thread
 
jayswaan profile image
JaySwaan

Hey Andrew, this is correct. I had a field in my config.yml called content which provided the content for my posts so all the data I needed was inside greyMatter(post).data and I destructured it all out of there. I'm not using the exact same setup so my data (including content) was all inside of data.