Skip to content

ContentRenderer not working as expected #1574

@miket2marcom

Description

@miket2marcom

Environment


  • Operating System: Darwin
  • Node Version: v16.17.1
  • Nuxt Version: 3.0.0-rc.11
  • Nitro Version: 0.5.4
  • Package Manager: npm@8.15.0
  • Builder: vite
  • User Config: modules
  • Runtime Modules: @nuxt/content@2.1.1
  • Build Modules: -

Reproduction

Description below, reproduction link of this here: https://stackblitz.com/edit/github-lvjgwk

I created a fresh nuxt-content project based on the guide here: https://content.nuxtjs.org/get-started

Rendering the 2 initial markdown pages in content/ (index.md & about.md) works well with the ContentDoc component out of the box. But we need to use ContentRenderer in our project to query content from various sources.

On the [...slug].vue page, I replaced ContentDoc with ContentRenderer, making my [...slug].vue page look like this:

<template>
  <main>
    <ContentRenderer :value="page" />
  </main>
</template>

<script setup>
const route = useRoute()
const { data: page } = await useAsyncData('page-data', () => queryContent('/', ...route.params.slug).findOne())
</script>

I still have the same 2 markdown files in content/, but now the pages aren't rendering correctly and navigation between them is broken. Only index.md ever renders, regardless if I'm on http://localhost:3002/ or http://localhost:3002/about, and there are no console errors.

Am I missing something here to get ContentRenderer working? Any help here would be greatly appreciated. Thanks!

Describe the bug

The ContentRenderer component does not seem to be fully working. I believe I am using it according to the docs.

Additional context

FYI this is related to issue #1565 - but here I've just made a new nuxt-content project to recreate it without any other variables from our production project. And I made a quick environment to reproduce this: https://stackblitz.com/edit/github-lvjgwk

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions