将vue-head与prerender-spa-plugin一起使用会导致标题和元标记在netlify上显示两次

时间:2018-11-21 08:03:26

标签: vue.js single-page-application vue-router netlify

仅当在netlify上直播时(尽管其prerender选项已关闭),才会发生此问题,而在本地服务时不会发生。

实时网站显示:

<title>about | anonplayer about | anonplayer</title>

title和meta标签是使用vue-head包设置的,就像这样

  head: {  
    title: {
      inner: "about | anonplayer",
      separator: ' ',
    }, ...

这会发生在我的单页应用的所有路由上,也发生在我打算拥有两组标签的meta标签上。

看起来像this

我使用了默认的预渲染设置,如下所示:

  config.plugins.push(new PrerenderSPAPlugin({
    // Required - The path to the webpack-outputted app to prerender.
    staticDir: path.join(__dirname, 'dist'),
    // Required - Routes to render.
    routes: ['/', '/about'].concat(contracts.map(each => `/${each.abi}/${each.contract}`)),
  }))

1 个答案:

答案 0 :(得分:0)

是相同的,但使用Angular

在我的案例中,

帮助将函数this.meta.addTag()替换为 this.meta.updateTag()

所以认为这不是托管问题)