如何让 Commento 在 Gridsome Vue 项目中工作?
How to get Commento working in Gridsome Vue project?
我建立了一个基于 Gridsome 的博客,我现在正尝试向其添加评论。我想避免使用 Disqus,所以我尝试使用 Commento。不幸的是,我似乎无法让它工作。我已将 ID 为 commento 的 div 添加到我的博客页面模板中:
<template>
<Layout :title="$page.blog.title">
<Header :post="$page.blog" />
<div class="g8-blog">
<div class="g8-blog-content" v-html="$page.blog.content" />
<div id="commento"></div>
</div>
</Layout>
</template>
并将 link 添加到我的元信息中。
metaInfo() {
let blog = this.$page.blog;
return {
title: blog.title,
link: [
{ src: 'https://cdn.commento.io/js/commento.js', defer: true }
]
}
}
当我检查页面代码时,它看起来不错,但 Commento 评论内容从未呈现。我还需要做些什么吗?
这个对我有用:
<script>
export default {
metaInfo() {
return {
title: this.$page.post.title,
script: [
{ src: 'https://cdn.commento.io/js/commento.js', defer: true }
]
};
}
};
</script>
我建立了一个基于 Gridsome 的博客,我现在正尝试向其添加评论。我想避免使用 Disqus,所以我尝试使用 Commento。不幸的是,我似乎无法让它工作。我已将 ID 为 commento 的 div 添加到我的博客页面模板中:
<template>
<Layout :title="$page.blog.title">
<Header :post="$page.blog" />
<div class="g8-blog">
<div class="g8-blog-content" v-html="$page.blog.content" />
<div id="commento"></div>
</div>
</Layout>
</template>
并将 link 添加到我的元信息中。
metaInfo() {
let blog = this.$page.blog;
return {
title: blog.title,
link: [
{ src: 'https://cdn.commento.io/js/commento.js', defer: true }
]
}
}
当我检查页面代码时,它看起来不错,但 Commento 评论内容从未呈现。我还需要做些什么吗?
这个对我有用:
<script>
export default {
metaInfo() {
return {
title: this.$page.post.title,
script: [
{ src: 'https://cdn.commento.io/js/commento.js', defer: true }
]
};
}
};
</script>