-
Notifications
You must be signed in to change notification settings - Fork 128
/
_singlePost.vue
executable file
·71 lines (71 loc) · 1.85 KB
/
_singlePost.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<template>
<div id="post-page" class="page-wrapper post-page">
<site-hero :title="title" :subtitle="subtitle" :image="featureImage">
<span
v-if="author && $siteConfig.posts.displayAuthor"
class="author-wrapper"
>
<strong>Author:</strong> {{ author }}
</span>
<span v-if="date" class="date-wrapper">
<strong>Published on:</strong> {{ date }}
</span>
</site-hero>
<main-section :one-column-constrained="true">
<template v-slot:default>
<div class="post-wrapper">
<markdown :markdown="$store.state.content" />
<div class="other-posts">
<h6 class="subtitle is-size-4">
Related Posts
</h6>
<!-- Related Posts -->
<posts-grid :number="3" :category="category" :exclude="slug" />
</div>
<disqus-comments :identifier="$route.params.singlePost" />
</div>
</template>
<template v-slot:sidebar>
<post-sidebar />
</template>
</main-section>
</div>
</template>
<script>
import { mapState } from 'vuex'
import { setPageData, getFormattedDate } from '../helper'
// import 'highlight.js/styles/github.css'
import Markdown from '~/components/Markdown'
import PostSidebar from '~/components/PostSidebar'
export default {
components: {
Markdown,
PostSidebar
},
computed: {
...mapState([
'title',
'subtitle',
'featureImage',
'underSubtitle',
'author',
'category',
'slug'
]),
date() {
return getFormattedDate(this.$store.state.date)
},
url() {
return `${process.env.URL}/${this.$route.fullPath}`
}
},
fetch({ store, params }) {
setPageData(store, { resource: 'post', slug: params.singlePost })
}
}
</script>
<style scoped lang="scss">
.edit-post {
margin-bottom: 20px;
}
</style>