Skip to content

Warning - node.children.flatMap and problem to get $content #769

Closed
@kriss145

Description

@kriss145

Hello,

I've created a fresh project with the latest Nuxt.js and @nuxt/content module.

  1. When I starting I have the warning:
    Could not parse ./content/index.md: node.children.flatMap(...) is not a function or its return value is not iterable

  2. I'm trying to get a content from index.md but it's error. I don't know why.
    Example of code:

  async asyncData({ $content, params, error }) {
    const slug = params.slug || 'index'
    const page = await $content(slug)
      .fetch()
      .catch(() => {
        error({ statusCode: 404, message: 'Page not found' })
      })

    return {
      page,
    }
  },

Do you know what is happening with it?

Version

@nuxt/content: ^1.11.1
nuxt: ^2.14.12

What is Expected?

I would get a content from index.md

What is actually happening?

I can't get any content from index.md

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions