json - 在 Angular 通用 API 调用后 JSON-LD 不起作用
问题描述
我正在使用 Angular 7 和 Angular 通用,并将使用 JSON-LD 实现 Google 结构化数据。
JSON-LD 不是静态的,需要通过 API 获取值。顺便说一句,静态 JSON-LD 效果很好,但在 API 调用之后,它就不起作用了。
- app.component.html
<ngx-json-ld [json]="schema"></ngx-json-ld>
- app.component.ts
this._appService.getAPI(`${this.storyApiUrl}`).subscribe(result => {
const json = {
'@context': 'https://schema.org/',
'@type': 'Article',
'headline': result.meta.seo.title,
'name': result.meta.seo.author,
'datePublished': result.data.posted_on,
'dateModified': result.data.posted_on,
...
}
...
请帮我!
解决方案
推荐阅读
- sql-server - 使用 Azure 数据工厂中的复制数据工具指定要复制的表的顺序以尊重外键
- django - 修改基于类的视图以将数据添加到登录用户
- c - 我该如何继续计算这个函数(f3)的时间复杂度?
- javascript - 为 Gatsby 上的 onRouteUpdate 元素添加样式或类
- c# - 如何在运行时使用 Unity3D 设置撤消/重做系统
- angular - tsconfig 中的路径映射被解释为外部模块
- python - Jupyter 中的这两个 Python Notebook 有什么区别?
- r - R中的Plot_ly:如何添加正确的轴标签和刻度值?
- java - R中原始数据类型和类之间的关系
- html - Angular 8 *ngIf 无法在导航栏中正确反映 UI