Some Context
I'm building a blog, with content mostly coming from markdown files, using NuxtJS Content.
It if helps, you can see my project on Github (or the deployed site here).
I understand how to create dynamic pages from the MD files under /content.
But I don't know how to inject content from one of these files into a static page.
content/
├── blog/
│ ├── post1.md
│ ├── post2.md
├── privacy/
│ ├── policy.md
│ └── something-else.md
pages/
├── blog/
│ ├── _slug.vue
├── privacy/
│ ├── _slug.vue
├── privacy.vue
├── index.vue
Using my current method/knowledge, I generated a dynamic page based on policy.md:
<template>
<article>
<nuxt-content :document="policy" />
</article>
</template>
<script>
export default {
async asyncData({ $content, params }) {
const policy = await $content('privacy', params.slug).fetch()
return { policy }
}
}
</script>
But I don't want to generate a dynamic page from the MD, or use the slug in the route.
I want to take the contents of policy.md, and insert them into privacy.vue - but I don't know how.
What I tried
It doesn't work using the method from above, but I feel like it should.
console.log(policy) returns [object] [OBJECT]
& console.log(policy.title) returns undefined
What should this tell me? (trying to improve my debugging skills here lol)
Why does this work in _slug.vue but not in page.vue?
Feel like I'm missing some contextual knowledge re: how things work / what the right approach is here.