mat.services/pages/blog/_slug.vue

42 lines
737 B
Vue
Raw Normal View History

2018-10-15 03:25:55 +00:00
<template lang="pug">
#post
2018-10-18 05:13:18 +00:00
h1.title {{ post.title }}
h2.subtitle {{ post.tagline }}
p {{ post.date | prettifyDateLong }}
hr
.post-body.content(v-html='post.body')
a(href='#top') top
2018-10-15 03:25:55 +00:00
</template>
<script>
export default {
2018-10-18 06:19:46 +00:00
async asyncData({ app, route, payload }) {
2018-10-18 05:13:18 +00:00
return {
2018-10-18 06:19:46 +00:00
post: (await app.$content('/').get(route.path)) || payload,
2018-10-18 05:13:18 +00:00
}
},
head() {
return {
title: this.post.title,
}
},
beforeMount() {
if (this.post.draft) {
this.$router.replace('/blog')
}
},
layout: 'compact',
2018-10-15 03:25:55 +00:00
}
</script>
2018-10-18 05:13:18 +00:00
<style lang="sass" scoped>
@import '~assets/sass/utilities'
.post-body
width: 75%
margin-bottom: 5rem
font-size: $size-medium
a
text-decoration: underline
</style>