nuxt / content

The file-based CMS for your Nuxt application, powered by Markdown and Vue components.
https://content.nuxt.com
MIT License
3.08k stars 624 forks source link

Vue Components in nested directories #2500

Closed Jannchie closed 8 months ago

Jannchie commented 8 months ago

In nuxt, vue components under the path components/Foo/Bar.vue can be called with <FooBar />. Components in components/content/ are not recognized in this way.

For example, components/content/Foo/Bar.vue cannot be use in markdown file by:

::foo-bar
::
nobkd commented 8 months ago

If you want to use the content folder and not add your own global component folder, you can only use the components by their base name. In your case, that would be :bar...

By default, directory names in components/content/ are ignored and not added as prefix of the component. You can add a rule to your nuxt.config.ts that states, that components in your directory are global and get prefixed.

See https://github.com/nuxt/content/discussions/2155#discussioncomment-6387021 for implementation details.

(Also, remember that there's a difference between global components and auto-imported ones: https://github.com/nuxt/content/issues/2256#issuecomment-1698091210)