@salesforcedevs/docs-components 0.56.2-seo-test10 → 0.56.2-seo-test11

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-test10",
3
+ "version": "0.56.2-seo-test11",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -558,8 +558,8 @@ export default class AmfReference extends LightningElement {
558
558
  return typeALbl < typeBLbl
559
559
  ? -1
560
560
  : typeALbl > typeBLbl
561
- ? 1
562
- : 0;
561
+ ? 1
562
+ : 0;
563
563
  });
564
564
  }
565
565
  // eslint-disable-next-line no-fallthrough
@@ -1076,18 +1076,6 @@ export default class AmfReference extends LightningElement {
1076
1076
  invalidTopicReferenceUrl = previousRefUrlInSession;
1077
1077
  }
1078
1078
  }
1079
- if (!invalidTopicReferenceUrl) {
1080
- const referenceUrl = window.location.href;
1081
- const referenceMeta =
1082
- this.getMarkdownReferenceMeta(referenceUrl);
1083
- const selectedItemRefId =
1084
- this.getReferenceIdFromUrl(referenceUrl);
1085
- const referenceDetails = this.getRefDetailsForGivenTopicMeta(
1086
- selectedItemRefId,
1087
- referenceMeta
1088
- );
1089
- this.updateNavTitleMetaTag(referenceDetails.topicTitle);
1090
- }
1091
1079
  this.loadMarkdownBasedReference(invalidTopicReferenceUrl);
1092
1080
  }
1093
1081
  }
@@ -1149,6 +1137,7 @@ export default class AmfReference extends LightningElement {
1149
1137
  }
1150
1138
  }
1151
1139
 
1140
+ let isRedirecting = false
1152
1141
  if (referenceId) {
1153
1142
  const amfConfig = this.getAmfConfigWithId(referenceId);
1154
1143
  let redirectReferenceUrl = "";
@@ -1161,6 +1150,7 @@ export default class AmfReference extends LightningElement {
1161
1150
  if (redirectReferenceUrl) {
1162
1151
  if (this.isParentReferencePath(referenceUrl)) {
1163
1152
  // This is for CASE2 mentioned above, Where we need to navigate user to respective href
1153
+ isRedirecting = true
1164
1154
  window.location.href = redirectReferenceUrl;
1165
1155
  } else {
1166
1156
  // This is for CASE 1,3 and 4 mentioned above, Where we need to update the browser history
@@ -1168,11 +1158,24 @@ export default class AmfReference extends LightningElement {
1168
1158
  }
1169
1159
  }
1170
1160
  }
1161
+ if (!isRedirecting) {
1162
+ const currentReferenceUrl = window.location.href;
1163
+ const referenceMeta =
1164
+ this.getMarkdownReferenceMeta(currentReferenceUrl);
1165
+ const selectedItemRefId =
1166
+ this.getReferenceIdFromUrl(currentReferenceUrl);
1167
+ const referenceDetails = this.getRefDetailsForGivenTopicMeta(
1168
+ selectedItemRefId,
1169
+ referenceMeta
1170
+ );
1171
+ if (referenceDetails) {
1172
+ this.updateNavTitleMetaTag(referenceDetails.topicTitle);
1173
+ }
1171
1174
 
1172
- this.versions = this.getVersions();
1173
-
1174
- this.updateDocPhase();
1175
- this.selectedSidebarValue = window.location.pathname;
1175
+ this.versions = this.getVersions();
1176
+ this.updateDocPhase();
1177
+ this.selectedSidebarValue = window.location.pathname;
1178
+ }
1176
1179
  }
1177
1180
 
1178
1181
  /**
@@ -13,7 +13,6 @@ import {
13
13
  import { SearchSyncer } from "docUtils/SearchSyncer";
14
14
  import { LightningElementWithState } from "docBaseElements/lightningElementWithState";
15
15
  import { Language } from "typings/custom";
16
- import { DEFAULT_LANGUAGES } from "dxUtils/constants";
17
16
 
18
17
  // TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
19
18
  const handleContentError = (error): void => console.log(error);
@@ -100,7 +99,7 @@ export default class DocXmlContent extends LightningElementWithState<{
100
99
  shouldStopPropagation: true,
101
100
  target: window
102
101
  });
103
- private _allLanguages: Array<Language> = DEFAULT_LANGUAGES;
102
+ private _allLanguages: Array<Language> = [];
104
103
 
105
104
  @track private pageReference: PageReference = {};
106
105
 
@@ -584,5 +583,20 @@ export default class DocXmlContent extends LightningElementWithState<{
584
583
  metadescription.setAttribute("content", docDescription);
585
584
  }
586
585
  }
586
+
587
+ if (this.pageReference) {
588
+ const metadescription = document.querySelector(
589
+ 'link[rel="canonical"]'
590
+ );
591
+ if (metadescription) {
592
+ metadescription.setAttribute(
593
+ "href",
594
+ window.location.protocol +
595
+ "//" +
596
+ window.location.host +
597
+ this.pageReferenceToString(this.pageReference)
598
+ );
599
+ }
600
+ }
587
601
  }
588
602
  }