Skip to content

How to read a simple yaml file? #1751

Answered by mohsin
mohsin asked this question in Q&A
Discussion options

You must be logged in to vote

Never mind. I found the solution. My yml file was starting with --- which is usually is only standard for multiple documents within single stream in yaml files. Nuxt Content was failing to pick it up as a result. I removed the dashes and I got a new property called body in the Log. So now I'm able to access my yml file content using:

var doc = await queryContent('data/projects').findOne()
console.log(doc.body)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mohsin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant