nuxt / content

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

use unocss preset icons as page content icon #2669

Open GreyXor opened 1 week ago

GreyXor commented 1 week ago

Is your feature request related to a problem? Please describe

I try to use icon from unocss/nuxt like my other component image image

but in nuxt-content it's not working image image

Describe the solution you'd like

Icon should be showed because icon exist

  <v-list nav>
    <ContentNavigation v-slot="{ navigation }">
      <v-list-item
        v-for="link of navigation"
        :key="link._path"
        :title="link.title"
        :prepend-icon="link.icon"
        :to="link._path"
      ></v-list-item>
    </ContentNavigation>
  </v-list>

Describe alternatives you've considered

Additional context

  "devDependencies": {
    "@iconify-json/mdi": "^1.1.66",
    "@nuxt/content": "^2.12.1",
    "@unocss/nuxt": "^0.61.0",
    "nuxt": "^3.12.2",
    "vuetify-nuxt-module": "^0.14.1"
  }
owljackob commented 6 days ago

What are the values of link.title and link.icon? Did you check?

GreyXor commented 6 days ago

What are the values of link.title and link.icon? Did you check?

Hello, yes, link.title and link.icon have the good value", as expected it's working, and link.icon is correctly i-mdi:home. and i-mdi:home is a working icon. You can have a look here :

---
navigation:
  title: 'i-mdi:home'
  icon: 'i-mdi:home'
---

# Dashboard

image

But if I set the icon directly like this

  <v-list nav>
    <v-list-item title="Dashboard" prepend-icon="i-mdi:home" to="/" />
  </v-list>

image

owljackob commented 6 days ago

Please, try to use i-mdi-home or mdi-home instead.

What are the values of link.title and link.icon? Did you check?

Hello, yes, link.title and link.icon have the good value", as expected it's working, and link.icon is correctly i-mdi:home. and i-mdi:home is a working icon. You can have a look here :

---
navigation:
  title: 'i-mdi:home'
  icon: 'i-mdi:home'
---

# Dashboard

image

But if I set the icon directly like this

  <v-list nav>
    <v-list-item title="Dashboard" prepend-icon="i-mdi:home" to="/" />
  </v-list>

image

GreyXor commented 6 days ago

Please, try to use i-mdi-home or mdi-home instead.

Thank you, but it doesn't work either.

GreyXor commented 6 days ago

I've noticed that if (in dev) I replace :prepend-icon="link.icon" with prepend-icon="mdi-home". then it works, and if I put back (still in the same dev session) :prepend-icon="link.icon". then it still work. It's as if the SSR icon didn't exist because it wasn't "generated".