@salesforcedevs/docs-components 1.3.55-seo-test3 → 1.3.55-seo-test5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.55-seo-test3",
3
+ "version": "1.3.55-seo-test5",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -676,19 +676,25 @@ export default class DocXmlContent extends LightningElementWithState<{
676
676
  }
677
677
  }
678
678
 
679
+ this.addNoIndexMetaForOlderDocVersions();
680
+ }
681
+
682
+ private addNoIndexMetaForOlderDocVersions() {
683
+ // eslint-disable-next-line @lwc/lwc/no-document-query
679
684
  const headTag = document.getElementsByTagName("head");
680
685
  // this checks if the selected version is not the latest version,
681
- // then it adds the noindex, follow meta tag to the page
686
+ // then it adds the noindex, follow meta tag to the older version pages.
687
+ // assumption is that first version in the availableVersions array is the latest.
682
688
  if (
683
689
  headTag.length &&
684
690
  this.version &&
685
691
  this.availableVersions.length &&
686
- this.version.id === this.availableVersions[0].id
692
+ this.version.id !== this.availableVersions[0].id
687
693
  ) {
688
- const robotsNoFollowMeta = document.createElement("meta");
689
- robotsNoFollowMeta.setAttribute("name", "robots");
690
- robotsNoFollowMeta.setAttribute("content", "noindex, follow");
691
- headTag[0].appendChild(robotsNoFollowMeta);
694
+ const robotsMeta = document.createElement("meta");
695
+ robotsMeta.setAttribute("name", "robots");
696
+ robotsMeta.setAttribute("content", "noindex, follow");
697
+ headTag[0].appendChild(robotsMeta);
692
698
  }
693
699
  }
694
700
  }