nuxt / content

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

ContentSlot loads default slot instead of custom slot #2494

Closed Reconnact closed 10 months ago

Reconnact commented 10 months ago

Environment


Reproduction

Unfortunately I couldn't create a reporduction. I'll do it as soon as I find time. Create a component with two named slots. Then use it in markdown:

::my-title
# Here is my title
#subtitle
Here is my subtitle
::

Now create a component that looks like this:

<template>
  <div>
    <p>
      <ContentSlot
        :use="$slots.subtitle"
        unwrap="p"
      />
    </p>
    <ContentSlot
      :use="$slots.default"
      unwrap="p"
    />
  </div>
</template>

Describe the bug

Instead of rendering the subtitle and then rendering the default slot it always renders the default slot. I had this bug on these nuxt versions:

UPDATE: I found the issue and was able to resolve it. But i think it is still a bug. Here you can see how it is working: https://stackblitz.com/edit/nuxt-starter-3i7tou?file=components%2Ftest.vue

As you can see the only "difference" is that my ContentSlot component looks like this:

<ContentSlot :use="$slots.subtitle" unwrap="p" />

Instead of this:

<ContentSlot
        :use="$slots.subtitle"
        unwrap="p"
/>

Additional context

No response

Logs

No response