@ -6,17 +6,20 @@
|
||||
|
||||
<script>
|
||||
import {
|
||||
defineComponent,
|
||||
useContext,
|
||||
ref,
|
||||
onMounted,
|
||||
useMeta,
|
||||
useStore,
|
||||
onMounted,
|
||||
useContext,
|
||||
defineComponent,
|
||||
} from '@nuxtjs/composition-api'
|
||||
import Prism from '~/plugins/prism'
|
||||
|
||||
export default defineComponent({
|
||||
head() {},
|
||||
setup() {
|
||||
const page = ref({})
|
||||
const { title, meta } = useMeta()
|
||||
const { $content, params, error } = useContext()
|
||||
const store = useStore()
|
||||
// Finding current path's slug.
|
||||
@ -26,6 +29,27 @@ export default defineComponent({
|
||||
.fetch()
|
||||
.then((doc) => {
|
||||
page.value = doc
|
||||
title.value = `${doc.title} - Dev blog`
|
||||
const meta_data = [
|
||||
{
|
||||
hid: 'og:title',
|
||||
name: 'og:title',
|
||||
content: doc.title,
|
||||
},
|
||||
{
|
||||
hid: 'og:description',
|
||||
name: 'og:description',
|
||||
content: doc.description,
|
||||
},
|
||||
]
|
||||
if (doc.image) {
|
||||
meta_data.push({
|
||||
hid: 'og:description',
|
||||
name: 'og:description',
|
||||
content: doc.image,
|
||||
})
|
||||
}
|
||||
meta.value = meta_data
|
||||
})
|
||||
.catch((_) => {
|
||||
error({ statusCode: 404, message: 'Page not found' })
|
||||
@ -47,7 +71,6 @@ export default defineComponent({
|
||||
@import '@/static/css/global-styles.scss';
|
||||
|
||||
.nuxt-content {
|
||||
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
|
||||
|
Reference in New Issue
Block a user