脸书链接分享

时间:2021-05-10 16:49:00

标签: html angular typescript firebase meta-tags

我试图添加在 Facebook 中共享网页时应显示的信息,作为博客文章的缩略图和标题。我已经将它部署在火力基地中,我正在检查。它不显示博客的相应图片和标题。

我在元标记中使用 og。我曾尝试在 index.html 中使用静态数据它可以工作,但在其他组件中它不能使用动态数据。

我在 firebase 中使用 angular。

this.blogdetailService.getSpecificBlogDetails(this.$key).subscribe(
  Blog => {
    this.blog = Blog[0];
    this.titleService.setTitle(this.blog.meta_title);
    this.meta.updateTag({name: 'title', content: this.blog.meta_title});
    this.meta.updateTag({name: 'keywords', content: this.blog.meta_keywords});
    this.meta.updateTag({name: 'description', content: this.blog.meta_description});
    this.meta.updateTag({ name: 'og:image', content: this.blog.blogImage });
    this.meta.updateTag({ name: 'og:title', content: this.blog.title });
    this.meta.updateTag({ name: 'og:type', content: "webiste" });
    // this.meta.updateTag({ name: 'og:locale', content: "en_us" });
    // this.meta.updateTag({ name: 'og:image:width', content: "400" });
    // this.meta.updateTag({ name: 'og:image:height', content: "300" });
    this.meta.updateTag({ name: 'og:url', content: window.location.href });
    this.meta.updateTag({ name: 'og:site_name', content: this.blog.title });
  }
);

0 个答案:

没有答案
相关问题