fix canonical url

This commit is contained in:
polv committed 2020-12-17 18:51:26 +07:00
1 parent fb69b2710f
commit 50e8530e96
5 files changed
+69 -11

No files matched your search

+61 -2
View File
@@ -59,6 +59,65 @@ import '~/assets/remark42'
post: r,
}
},
head() {
const { title: _title, content, tag, image } = this.post
const title = `${_title} - ${THEME.title}`
const description = content.substr(0, 140)
return {
title,
meta: [
{
hid: 'description',
name: 'description',
content: description,
},
...(tag
? [
{
hid: 'keywords',
name: 'keywords',
content: tag.join(','),
},
]
: []),
{
hid: 'og:title',
property: 'og:title',
content: title,
},
{
hid: 'og:description',
property: 'og:description',
content: description,
},
{
hid: 'twitter:title',
property: 'twitter:title',
content: title,
},
{
hid: 'twitter:description',
property: 'twitter:description',
content: description,
},
...(image
? [
{
hid: 'og:image',
property: 'og:image',
content: image,
},
{
hid: 'twitter:image',
property: 'twitter:image',
content: image,
},
]
: []),
],
}
},
mounted() {
this.initRemark42()
},
@@ -69,14 +128,14 @@ import '~/assets/remark42'
},
})
export default class PostPage extends Vue {
post: {
post!: {
date?: string
title: string
image?: string
tag?: string[]
category?: string[]
content: string
} | null = null
}
theme = THEME