@salesforcedevs/docs-components 1.3.108-seo-fix1 → 1.3.108-seo-fix3

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-seo-fix1",
3
+ "version": "1.3.108-seo-fix3",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -694,8 +694,15 @@ export default class DocXmlContent extends LightningElementWithState<{
694
694
  const docId = this.pageReference.docId;
695
695
 
696
696
  // SEO fix:
697
- // Condition is to find the docId which includes version id, these docs are always considered as old.
698
- if (headTag.length && docId?.includes(versionId)) {
697
+ // Doc id without version id is always considered latest and should be used for SEO.
698
+ // Condition is to find a docId which includes version id,
699
+ // these docs are always considered as old and should not be indexed including the preview docs.
700
+ if (
701
+ headTag.length &&
702
+ docId?.includes(versionId) &&
703
+ // eslint-disable-next-line @lwc/lwc/no-document-query
704
+ !document.querySelector('meta[name="robots"]')
705
+ ) {
699
706
  const robotsMeta = document.createElement("meta");
700
707
  robotsMeta.setAttribute("name", "robots");
701
708
  robotsMeta.setAttribute("content", "noindex, follow");