Dha*_* G. 6 dynamic meta-tags angular angular5 angular6
我想使用 API 调用在元标记中设置动态信息。当我通过检查进行检查时,它将显示更新的数据,但当我在 Facebook 上共享链接时,它不会反映更新的数据。
\n\n索引.html
\n\n <meta name="description" content="Create and share your biography">\n <meta name="og:url" content="window.location.href"> \n <meta name="og:title" content="TEACHERLIFE -SPANISH LESSONS">\n <meta name="og:description" content="So I\xe2\x80\x99m in my classroo...">\nRun Code Online (Sandbox Code Playgroud)\n\n在组件.ts中:
\n\nimport { Meta, Title } from \'@angular/platform-browser\';\n constructor(private metaService: MetaService,\n private meta: Meta,) {}\n ngOnInit() {\nthis.meta.updateTag( {name: \'og:description\', content:"testdescription"});\n}\nRun Code Online (Sandbox Code Playgroud)\n
小智 -2
import { Meta } from '@angular/platform-browser';
constructor(private meta: Meta) {}
ngOnInit() {
this.meta.updateTag(
{name: 'twitter:title', content:'Front-end Web Development'},
`name='twitter:title'`
);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3905 次 |
| 最近记录: |