feat: wip blog detail

This commit is contained in:
kmacoders 2021-07-08 23:07:44 +07:00
parent 11562d1701
commit 5822dcc59a
11 changed files with 44 additions and 7 deletions

View File

@ -1,6 +1,7 @@
--- ---
title: How to code title: How to code
description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.'
author: 'Huwng'
image: 'http://placekitten.com/g/1920/1080' image: 'http://placekitten.com/g/1920/1080'
tags: ['VueJS', 'Nuxt', 'Frontend'] tags: ['VueJS', 'Nuxt', 'Frontend']
published: '2020-02-12' published: '2020-02-12'

View File

@ -1,6 +1,7 @@
--- ---
title: Optimize your website title: Optimize your website
description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.'
author: 'Huwng'
image: 'http://placekitten.com/g/1920/1080' image: 'http://placekitten.com/g/1920/1080'
tags: ['NodeJs', 'Nuxt', 'Optimize'] tags: ['NodeJs', 'Nuxt', 'Optimize']
published: '2020-03-30' published: '2020-03-30'

View File

@ -1,6 +1,7 @@
--- ---
title: Deep folder Vue title: Deep folder Vue
description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.'
author: 'Huwng'
image: 'http://placekitten.com/g/1920/1080' image: 'http://placekitten.com/g/1920/1080'
tags: ['vuejs'] tags: ['vuejs']
published: '2020-01-12' published: '2020-01-12'

View File

@ -1,6 +1,7 @@
--- ---
title: Fisrt Blog Post eHandy title: Fisrt Blog Post eHandy
description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.'
author: 'Huwng'
image: 'http://placekitten.com/g/1920/1080' image: 'http://placekitten.com/g/1920/1080'
tags: ['Share', 'Nuxt'] tags: ['Share', 'Nuxt']
published: '2021-01-30' published: '2021-01-30'

View File

@ -1,6 +1,7 @@
--- ---
title: Fisrt Blog Post eHandy title: Fisrt Blog Post eHandy
description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.'
author: 'Huwng'
image: 'https://cdn.emk.dev/templates/featured-image.png' image: 'https://cdn.emk.dev/templates/featured-image.png'
tags: ['VueJS', 'Nuxt'] tags: ['VueJS', 'Nuxt']
published: '2021-02-30' published: '2021-02-30'

View File

@ -1,6 +1,7 @@
--- ---
title: Fisrt Blog Post eHandy title: Fisrt Blog Post eHandy
description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.'
author: 'Huwng'
image: 'http://placekitten.com/g/1920/1080' image: 'http://placekitten.com/g/1920/1080'
tags: ['Node', 'Nuxt'] tags: ['Node', 'Nuxt']
published: '2021-03-30' published: '2021-03-30'

View File

@ -1,6 +1,7 @@
--- ---
title: Learn Nuxt from scratch title: Learn Nuxt from scratch
description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.'
author: 'Huwng'
image: 'http://placekitten.com/g/1920/1080' image: 'http://placekitten.com/g/1920/1080'
tags: ['VueJS', 'Nuxt'] tags: ['VueJS', 'Nuxt']
published: '2021-04-30' published: '2021-04-30'

View File

@ -1,6 +1,7 @@
--- ---
title: Placeholder image shopify title: Placeholder image shopify
description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.'
author: 'Huwng'
image: 'http://placekitten.com/g/1920/1080' image: 'http://placekitten.com/g/1920/1080'
tags: ['Fun', 'Nuxt'] tags: ['Fun', 'Nuxt']
published: '2021-05-30' published: '2021-05-30'

View File

@ -1,6 +1,7 @@
--- ---
title: Shopify partner title: Shopify partner
description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.'
author: 'Huwng'
image: 'http://placekitten.com/g/1920/1080' image: 'http://placekitten.com/g/1920/1080'
tags: ['VueJS', 'Shopify'] tags: ['VueJS', 'Shopify']
published: '2022-06-30' published: '2022-06-30'

View File

@ -1,13 +1,27 @@
<template> <template>
<article class="container content"> <div class="blog-detail container is-max-desktop content">
<div class="columns"> <section class="section blog-detail__featured-img">
<div class="column"> <img :src="blogDetail.image">
<nuxt-content :document="blogDetail" /> </section>
<section class="section blog-detail__info">
<h1 class="title is-2">
{{ blogDetail.title }}
</h1>
<div>
<span>{{ blogDetail.author }}</span>
</span>{{ blogDetail.published }}</span>
</div> </div>
</div> <hr>
</article> </section>
<section class="section">
<div class="columns">
<div class="column">
<nuxt-content :document="blogDetail" />
</div>
</div>
</section>
</div>
</template> </template>
<script> <script>
import { Vue, Component } from 'nuxt-property-decorator' import { Vue, Component } from 'nuxt-property-decorator'
import global from '@/utils/global' import global from '@/utils/global'
@ -20,6 +34,7 @@ import getSiteMeta from '@/utils/getSiteMeta'
.where({ slug: params.slug }) .where({ slug: params.slug })
.fetch() .fetch()
const [blogDetail] = findedBlog const [blogDetail] = findedBlog
console.log(blogDetail)
const [prev, next] = await $content('blog', { deep: true }) const [prev, next] = await $content('blog', { deep: true })
.only(['title', 'slug', 'published']) .only(['title', 'slug', 'published'])
@ -93,3 +108,14 @@ import getSiteMeta from '@/utils/getSiteMeta'
}) })
export default class BlogDetail extends Vue {} export default class BlogDetail extends Vue {}
</script> </script>
<style lang="scss">
.blog-detail {
section:not(:last-child) {
padding-bottom: 0;
}
section:not(:first-child) {
padding-top: 1rem;
}
}
</style>

View File

@ -15,4 +15,6 @@ export interface IContent extends IContentDocument {
toc: IToc[]; toc: IToc[];
image: string; image: string;
tags: string[]; tags: string[];
published: string;
author: string;
} }