@salesforcedevs/docs-components 1.2.20-alpha → 1.2.22-alpha

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.2.20-alpha",
3
+ "version": "1.2.22-alpha",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -616,15 +616,9 @@ export default class DocXmlContent extends LightningElementWithState<{
616
616
  }
617
617
 
618
618
  dropVersionFromDocId(docId: string): string {
619
- const docIdElemets = docId.split(".");
620
- const filteredDocId = docIdElemets.filter((docIdElement) => {
621
- const versionRegex = /^[0-9]+$/;
622
- if (versionRegex.test(docIdElement)) {
623
- return "";
624
- }
625
- return docIdElement;
626
- });
627
- return filteredDocId.join(".");
619
+ const curVersion = this.version.id + ".";
620
+ const filteredDocId = docId.replace(curVersion, "");
621
+ return filteredDocId;
628
622
  }
629
623
 
630
624
  addMetatags(): void {
@@ -658,15 +652,16 @@ export default class DocXmlContent extends LightningElementWithState<{
658
652
  'link[rel="canonical"]'
659
653
  );
660
654
  if (metadescription) {
661
- this.pageReference.docId = this.pageReference.docId
662
- ? this.dropVersionFromDocId(this.pageReference.docId)
663
- : this.pageReference.docId;
655
+ const copyPageReference = { ...this.pageReference };
656
+ copyPageReference.docId = copyPageReference.docId
657
+ ? this.dropVersionFromDocId(copyPageReference.docId)
658
+ : copyPageReference.docId;
664
659
  metadescription.setAttribute(
665
660
  "href",
666
661
  window.location.protocol +
667
662
  "//" +
668
663
  window.location.host +
669
- this.pageReferenceToString(this.pageReference)
664
+ this.pageReferenceToString(copyPageReference)
670
665
  );
671
666
  }
672
667
  }