RatsClan
RatsClan
NNuxt
Created by jess on 11/1/2024 in #❓・help
Can I get a recipe for using @nuxt/content with layouts? I'm super confused.
As this isn't possible without document driven mode, and I'm using Options API, I opted for declaring it within the page's defineNuxtComponent instead, above where I query the head content...
// pages/help.vue
export default defineNuxtComponent({
async asyncData() {
definePageMeta({
layout: 'wiki'
});
const doc = await queryContent(useRoute().path).findOne();
useContentHead(doc);
return { doc };
}
})
// pages/help.vue
export default defineNuxtComponent({
async asyncData() {
definePageMeta({
layout: 'wiki'
});
const doc = await queryContent(useRoute().path).findOne();
useContentHead(doc);
return { doc };
}
})
33 replies
NNuxt
Created by jess on 11/1/2024 in #❓・help
Can I get a recipe for using @nuxt/content with layouts? I'm super confused.
Yup. Couldn't see the wood for the trees! I searched the docs and didn't even realise I was on the document driven page 🙃
33 replies
NNuxt
Created by jess on 11/1/2024 in #❓・help
Can I get a recipe for using @nuxt/content with layouts? I'm super confused.
May I piggy back this to also ask how do I set a page's layout when using Nuxt Content with JSON files? The docs for Layout binding only shows an example with Markdown/front-matter https://content.nuxt.com/document-driven/introduction#layout-binding Which I presumed would translate to the root of JSON, which unfortunately doesn't work: content/grid.json
{
"layout": "grid",
"navigation": {
"title": "Grid"
},
"head": {
"title": "The Grid Layout",
}
}
{
"layout": "grid",
"navigation": {
"title": "Grid"
},
"head": {
"title": "The Grid Layout",
}
}
33 replies
NNuxt
Created by El Jovial on 7/15/2024 in #❓・help
tsconfig.json Error
Update: it did work! It just took a long time for VSCode to remove the error message.
5 replies
NNuxt
Created by El Jovial on 7/15/2024 in #❓・help
tsconfig.json Error
I'm experiencing this too, but unfortunately the above solution doesn't help 🤔
5 replies