@salesforcedevs/docs-components 0.56.2-seo-test14 → 0.56.2-seo-test17

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": "0.56.2-seo-test14",
3
+ "version": "0.56.2-seo-test17",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -482,6 +482,7 @@ export default class AmfReference extends LightningElement {
482
482
  parentReferencePath: string,
483
483
  meta: string
484
484
  ): string {
485
+ // update the encoded url meta param
485
486
  const encodedMeta = meta ? this.getUrlEncoded(meta) : "";
486
487
  return encodedMeta ? `${parentReferencePath}?meta=${encodedMeta}` : "";
487
488
  }
@@ -733,6 +734,7 @@ export default class AmfReference extends LightningElement {
733
734
  meta?: string
734
735
  ): void {
735
736
  if (meta) {
737
+ // update the encoded url meta param
736
738
  const encodedMeta = this.getUrlEncoded(meta);
737
739
  window.history.pushState(
738
740
  {},
@@ -750,6 +752,7 @@ export default class AmfReference extends LightningElement {
750
752
  meta?: string
751
753
  ): void {
752
754
  if (meta) {
755
+ // update the encoded url meta param
753
756
  const encodedMeta = this.getUrlEncoded(meta);
754
757
  window.history.replaceState(
755
758
  {},
@@ -878,14 +881,21 @@ export default class AmfReference extends LightningElement {
878
881
  }
879
882
 
880
883
  /**
881
- * @returns meta query param from given Url
884
+ * Returns the decoded meta query param from given Url as it is being used internally.
882
885
  */
883
886
  getMetaFromUrl(referenceUrl: string): string {
884
887
  const indexOfQueryParam = referenceUrl.indexOf("?");
885
888
  const urlPath = referenceUrl.substring(
886
889
  indexOfQueryParam >= 0 ? indexOfQueryParam : referenceUrl.length
887
890
  );
888
- return this.parseParams(urlPath).meta as string;
891
+ const meta = this.parseParams(urlPath).meta as string;
892
+ // Always get the meta query param encoded and decode it and store it for internal use
893
+ // This has 2 advantages,
894
+ // 1. Supports backward compatible meta query param, so there is no need for redirects.
895
+ // 2. Supports Prerender and Coveo for their crawling.
896
+ const encodedMeta = meta && this.getUrlEncoded(meta);
897
+ const decodedMeta = encodedMeta && decodeURIComponent(encodedMeta);
898
+ return decodedMeta || "";
889
899
  }
890
900
 
891
901
  /**
@@ -908,6 +918,9 @@ export default class AmfReference extends LightningElement {
908
918
 
909
919
  /**
910
920
  * Gets the encoded url.
921
+ * This method will return the encoded url for 2 cases,
922
+ * 1. If the url is encoded already
923
+ * 2. If the url is decoded
911
924
  */
912
925
  getUrlEncoded(url: string) {
913
926
  // if url matches, then return the encoded url.
@@ -934,10 +947,6 @@ export default class AmfReference extends LightningElement {
934
947
  let type = "";
935
948
  if (this.isSpecBasedReference(referenceId)) {
936
949
  meta = this.getMetaFromUrl(referenceUrl);
937
- // Always get the meta query param encoded and decode it and store it for internal use
938
- // This has 2 advantages,
939
- // 1. Supports backward compatible meta query param, so there is no need for redirects.
940
- // 2. Supports Prerender and Coveo for their crawling.
941
950
  if (meta) {
942
951
  if (meta.includes(":")) {
943
952
  const metaInfo = meta.split(":");