使用Meteor中的DocHead动态设置元标记

时间:2016-05-15 00:25:55

标签: javascript meteor

我正在我的<meta>中为Twitter卡动态设置<head>标记。当我检查Chrome上的<head>时,以下设置了元标记:

  FlowRouter.route('/', {
    name: 'home',
    action() {
      let title = 'my app';
      DocHead.setTitle(title);

      DocHead.removeDocHeadAddedTags();
      DocHead.addMeta({name: 'twitter:card', content: 'summary'});
      DocHead.addMeta({name: 'twitter:site', content: '@myapp'});
      DocHead.addMeta({name: 'twitter:title', content: 'my app title'});
      DocHead.addMeta({name: 'twitter:description', content: 'my app desc'});
      DocHead.addMeta({name: 'twitter:image', content: 'logourl'});

      mount(MainLayoutCtx, {
        content: () => (<Home />)
      });
    }
  });

但是当我使用诸如social debug之类的工具调试它时,我总是得到没有找到Twitter的元标记。是什么赋予了?我在我的应用中使用spiderable。这也发生在制作上。

0 个答案:

没有答案