fix canonical url
This commit is contained in:
1 parent
fb69b2710f
commit
50e8530e96
5 files changed
+69
-11
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Plugin } from '@nuxt/types'
|
||||
|
||||
const plugin: Plugin = ({ $axios, error }) => {
|
||||
if (typeof location !== 'undefined') {
|
||||
$axios.defaults.baseURL = location.origin
|
||||
}
|
||||
$axios.defaults.baseURL =
|
||||
typeof location !== 'undefined'
|
||||
? location.origin
|
||||
: `http://localhost:${process.env.SERVER_PORT}`
|
||||
|
||||
$axios.interceptors.response.use(
|
||||
(r) => {
|
||||
|
||||
@@ -108,7 +108,7 @@ export class MakeHtml {
|
||||
|
||||
return {
|
||||
html: this.$('<div>').append($div).html() || '',
|
||||
text: $div.text(),
|
||||
text: $div.text().trim(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,9 @@ export async function runServer() {
|
||||
await initDatabase()
|
||||
|
||||
const app = express()
|
||||
app.use(morgan('common'))
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
app.use(morgan('common'))
|
||||
}
|
||||
|
||||
const router = express.Router()
|
||||
app.use('/api', router)
|
||||
|
||||
Reference in new issue
Block a user