微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html – Meteor标签的建议

Meteor用户,

在我搜索教程和示例应用程序期间,我找到了一个使用独特头部结构的应用程序:

<Meta charset="utf-8">
  <title>Title</title>
  <Meta name="description" content="Top10">
  <Meta name="viewport" content="width=device-width" />
  <Meta name="viewport" content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1">

这个特定的示例应用程序甚至没有< body>标记任何地方,只是一个名为head.html的文件,其中包含上述代码.我还了解到,Meteor似乎只是自动为你制作一个身体标签,所以从技术上讲,只需一个head.html即可.

所以,它让我想知道,有没有人定义Meteor应用程序的特定头标?理由是什么?以上代码一个很好的起点吗?

解决方法

您可以使用iron:router来轻松设置动态标题,例如:
onAfteraction: function(){
  document.title = 'my awesome site: ' + Router.current().route.getName();
}

我使用head.html,其中包括各种SEO设置:

<head>
<Meta name="viewport" content="width=device-width,initial-scale=1"/>
<Meta name="fragment" content="!"/>
<Meta name="description" content="your description"/>
<Meta property="og:title" content="your site title"/>
<Meta property="og:type" content="website"/>
<Meta property="og:image" content="https://yourimageurl"/>
<Meta property="og:url" content="https://hostname"/>
<Meta property="og:description" content="your description"/>
<Meta name="twitter:card" content="summary"/>
<Meta name="twitter:url" content="https://hostname"/>
<Meta name="twitter:title" content="your site title"/>
<Meta name="twitter:description" content="your site description"/>
<Meta name="twitter:image" content="https://yourimageurl">
<noscript>You must have Javascript enabled in order to use this site</noscript>
<link rel="shortcut icon" href="/your-ico" type="image/x-icon" />
</head>

原文地址:https://www.jb51.cc/html/232186.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐