Angular Universal - OG meta tags not working with child routes

My website hosted on http://abc.xyz.com OG meta tag works for the main page. If I am adding it to the child routes it doesn't work. for example - http://abc.xyz.com/pqr/slug-url.

index.html

<meta property="og:type" content="article">
<meta property="og:site_name" content="XYZ" >
<meta property="og:title" content="XYZ" >
<meta property="og:description" content="XYZ" >
<meta property="og:image" content="xyz imagepath" >
<meta property="og:url" content="xyz url" >

component.ts

 this.meta.updateTag({ property: 'og:type', content: 'article' });
 this.meta.updateTag({ property: 'og:site_name', content: 'XYZ' });
 this.meta.updateTag({ property: 'og:title', content: config.title });
 this.meta.updateTag({ property: 'og:description', content: config.description });
 this.meta.updateTag({ property: 'og:image', content: config.image });
 this.meta.updateTag({ property: 'og:url', content: config.url });

server.js

app.engine('html', ngExpressEngine({
  bootstrap: AppServerModuleNgFactory
}));
app.set('view engine', 'html');
app.set('views', './');
app.use('/', express.static('./', {index: false}));
app.get('*', (req, res) => {
  res.render('index', {
    req
  });
});

If I am checking on developer tool, it shows added meta tags but doesn't reflect on Facebook while posting page.

Thanks.

Answers:

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.