Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ブログを作るなら Nuxt Content v2はいいぞ

Avatar for Fulu Fulu
October 16, 2022

ブログを作るなら Nuxt Content v2はいいぞ

Vue Fes Japan 2022 のLT内容です

https://vuefes.jp/2022/sessions/FurusawaKaoru

Avatar for Fulu

Fulu

October 16, 2022
Tweet

Other Decks in Technology

Transcript

  1. 使用例① <script setup lang="ts"> defineProps<{ id: string }>() </script> <template>

    <h1 :id="id" class="mb-8 border-b pb-2 text-4xl font-bold"> <a :href="`#${id}`" class="group relative"> <slot /> <font-awesome-icon icon="link" class="absolute text-base opacity-0 group-hover:opacity-100" /> </a> </h1> </template> components/content/ProseH1.vue
  2. 使用例② <template> <div class="bg-gray-100 p-4 relative"> <slot /> <font-awesome-icon icon="copy"

    class="absolute bottom-2 right-2 opacity-0 hover:opacity-100" @click="copy" /> </div> </template> components/content/ProseCode.vue
  3. MDC(MarkDown Components) Syntax markdownから任意のVue Componentを使うことができる。 # Hello ## Nuxt Content

    はいいぞ ::card The content of the card :: content/index.md <template> <div class="rounded border bg-white p-6"> <slot /> </div> </template> components/content/Card.vue
  4. • markdownで書いた記事をディレクトリに置くだけで静的コンテンツを作れます • Prose Components: 各タグを簡単にカスタマイズできる • MDC Syntax: markdownからVue

    Componentが使える • 他にも便利な機能がある ◦ nuxt.configに設定するだけでcodeのHigh Lightができる ◦ Mongo DBライクにデータを取得できるAPI Nuxt Contentはいいぞ