@salesforcedevs/docs-components 1.3.108 → 1.3.109

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.108",
3
+ "version": "1.3.109",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -24,5 +24,5 @@
24
24
  "@types/lodash.orderby": "^4.6.7",
25
25
  "@types/lodash.uniqby": "^4.7.7"
26
26
  },
27
- "gitHead": "2305f4c1cc75decc2dec5aadea4dac96a1c22cdc"
27
+ "gitHead": "dc6143d85c8352cce4abf6c8d5c96b79c5bcfce2"
28
28
  }
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @lwc/lwc/no-document-query */
1
2
  import { api, track } from "lwc";
2
3
  import { normalizeBoolean } from "dxUtils/normalizers";
3
4
  import { FetchContent } from "./utils";
@@ -690,12 +691,17 @@ export default class DocXmlContent extends LightningElementWithState<{
690
691
  const headTag = document.getElementsByTagName("head");
691
692
  // this checks if the selected version is not the latest version,
692
693
  // then it adds the noindex, follow meta tag to the older version pages.
693
- // assumption is that first version in the availableVersions array is the latest.
694
+ const versionId = this.version.id;
695
+ const docId = this.pageReference.docId;
696
+
697
+ // SEO fix:
698
+ // Doc id without version id is always considered latest and should be used for SEO.
699
+ // Condition is to find a docId which includes version id,
700
+ // these docs are always considered as old and should not be indexed including the preview docs.
694
701
  if (
695
702
  headTag.length &&
696
- this.version &&
697
- this.availableVersions.length &&
698
- this.version.id !== this.availableVersions[0].id
703
+ docId?.includes(versionId) &&
704
+ !document.querySelector('meta[name="robots"]')
699
705
  ) {
700
706
  const robotsMeta = document.createElement("meta");
701
707
  robotsMeta.setAttribute("name", "robots");