@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
|
@@ -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
|
|
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
|
|
692
|
+
this.version.id !== this.availableVersions[0].id
|
|
687
693
|
) {
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
headTag[0].appendChild(
|
|
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
|
}
|