File tree Expand file tree Collapse file tree 2 files changed +45
-7
lines changed
Expand file tree Collapse file tree 2 files changed +45
-7
lines changed Original file line number Diff line number Diff line change 11<template >
2- <nuxt-content :document =" page" class =" prose lg:prose-xl max-w-none" />
2+ <div
3+ class =" px-8 mx-auto mt-12 prose sm:px-6 md:px-4 lg:px-2 xl:px-0 xl:prose-xl lg:prose-lg md:prose-md"
4+ >
5+ <h2 >{{ post.title }}</h2 >
6+ <p >{{ post.description }}</p >
7+ <nuxt-content :document =" post" />
8+ <h3 >Tags</h3 >
9+ <ul >
10+ <li v-for =" (tag, index) in post.tags" :key =" index" >
11+ <nuxt-link :to =" `/tags/${tag}`" >
12+ {{ tag }}
13+ </nuxt-link >
14+ </li >
15+ </ul >
16+ </div >
317</template >
418
519<script >
620export default {
7- async asyncData ({ $content }) {
8- const page = await $content (' index ' ).fetch ()
21+ async asyncData ({ $content, params : { slug } }) {
22+ const post = await $content (' blog ' , slug ).fetch ()
923
1024 return {
11- page ,
25+ post ,
1226 }
1327 },
1428}
Original file line number Diff line number Diff line change 11<template >
2- <nuxt-content :document =" page" class =" prose lg:prose-xl max-w-none" />
2+ <div >
3+ <Hero heading =" Latest Stories" image =" /img/blog-index.jpg" />
4+ <div
5+ class =" px-8 mx-auto mt-12 prose sm:px-6 md:px-4 lg:px-2 xl:px-0 xl:prose-xl lg:prose-lg md:prose-md"
6+ >
7+ <h1 >Latest Stories</h1 >
8+ <div class =" lg:grid lg:grid-cols-2 lg:gap-8" >
9+ <div
10+ v-for =" (post, index) in posts"
11+ :key =" index"
12+ class =" px-6 no-underline bg-gray-200 rounded-lg shadow-lg"
13+ >
14+ <h3 >
15+ <nuxt-link :to =" `/blog/${post.slug}`" >{{ post.title }}</nuxt-link >
16+ </h3 >
17+ <p >
18+ {{ post.description }}
19+ </p >
20+ <p >
21+ <nuxt-link :to =" `/blog/${post.slug}`" >Read more</nuxt-link >
22+ </p >
23+ </div >
24+ </div >
25+ </div >
26+ </div >
327</template >
428
529<script >
630export default {
731 async asyncData ({ $content }) {
8- const page = await $content (' index ' ).fetch ()
32+ const posts = await $content (' blog ' ).fetch ()
933
1034 return {
11- page ,
35+ posts ,
1236 }
1337 },
1438}
You can’t perform that action at this time.
0 commit comments