Skip to content

Commit

Permalink
Merge pull request #877 from VirtualFlyBrain/debug
Browse files Browse the repository at this point in the history
ensuring meta is added
  • Loading branch information
Robbie1977 authored Jan 3, 2021
2 parents 0ff5d3d + 1dd337a commit c0b5483
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions components/VFBMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -1278,8 +1278,18 @@ class VFBMain extends React.Component {
document.querySelector('meta[property="og:title"]').setAttribute("content",this.responseXML.title);
document.querySelector('meta[name="description"]').setAttribute("content",this.responseXML.body.innerText);
document.querySelector('meta[property="og:description"]').setAttribute("content",this.responseXML.body.innerText);
if (document.getElementById('metaDesc') != null && this.responseXML.head != undefined && this.responseXML.head.getElementsByTagName('script') != undefined && this.responseXML.head.getElementsByTagName('script') != null && this.responseXML.head.getElementsByTagName('script')[1] != undefined) {
document.getElementById('metaDesc').innerHTML = this.responseXML.head.getElementsByTagName('script')[1].innerHTML;
if (document.getElementById('metaDesc') != null) {
if (this.responseXML.head != undefined && this.responseXML.head.getElementsByTagName('script') != undefined && this.responseXML.head.getElementsByTagName('script') != null && this.responseXML.head.getElementsByTagName('script')[1] != undefined) {
document.getElementById('metaDesc').innerHTML = this.responseXML.head.getElementsByTagName('script')[1].innerHTML;
}
} else {
if (this.responseXML.head != undefined && this.responseXML.head.getElementsByTagName('script') != undefined && this.responseXML.head.getElementsByTagName('script') != null && this.responseXML.head.getElementsByTagName('script')[1] != undefined) {
var script = document.createElement('script');
script.type = 'application/ld+json';
script.id = 'metaDesc';
script.innerHTML = this.responseXML.head.getElementsByTagName('script')[1].innerHTML;
document.getElementsByTagName('head')[0].appendChild(script);
}
}
}
} catch (err) {
Expand Down

0 comments on commit c0b5483

Please sign in to comment.