@salesforcedevs/docs-components 0.56.2-seo-test8 → 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-test8",
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
@@ -1046,7 +1046,6 @@ export default class AmfReference extends LightningElement {
1046
1046
  referenceId,
1047
1047
  "summary"
1048
1048
  );
1049
- this.updateNavTitleMetaTag(selectedItemMetaData.navTitle);
1050
1049
  }
1051
1050
 
1052
1051
  if (selectedItemMetaData) {
@@ -1077,18 +1076,6 @@ export default class AmfReference extends LightningElement {
1077
1076
  invalidTopicReferenceUrl = previousRefUrlInSession;
1078
1077
  }
1079
1078
  }
1080
- if (!invalidTopicReferenceUrl) {
1081
- const referenceUrl = window.location.href;
1082
- const referenceMeta =
1083
- this.getMarkdownReferenceMeta(referenceUrl);
1084
- const selectedItemRefId =
1085
- this.getReferenceIdFromUrl(referenceUrl);
1086
- const referenceDetails = this.getRefDetailsForGivenTopicMeta(
1087
- selectedItemRefId,
1088
- referenceMeta
1089
- );
1090
- this.updateNavTitleMetaTag(referenceDetails.topicTitle);
1091
- }
1092
1079
  this.loadMarkdownBasedReference(invalidTopicReferenceUrl);
1093
1080
  }
1094
1081
  }
@@ -1150,6 +1137,7 @@ export default class AmfReference extends LightningElement {
1150
1137
  }
1151
1138
  }
1152
1139
 
1140
+ let isRedirecting = false
1153
1141
  if (referenceId) {
1154
1142
  const amfConfig = this.getAmfConfigWithId(referenceId);
1155
1143
  let redirectReferenceUrl = "";
@@ -1162,6 +1150,7 @@ export default class AmfReference extends LightningElement {
1162
1150
  if (redirectReferenceUrl) {
1163
1151
  if (this.isParentReferencePath(referenceUrl)) {
1164
1152
  // This is for CASE2 mentioned above, Where we need to navigate user to respective href
1153
+ isRedirecting = true
1165
1154
  window.location.href = redirectReferenceUrl;
1166
1155
  } else {
1167
1156
  // This is for CASE 1,3 and 4 mentioned above, Where we need to update the browser history
@@ -1169,11 +1158,24 @@ export default class AmfReference extends LightningElement {
1169
1158
  }
1170
1159
  }
1171
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
+ }
1172
1174
 
1173
- this.versions = this.getVersions();
1174
-
1175
- this.updateDocPhase();
1176
- this.selectedSidebarValue = window.location.pathname;
1175
+ this.versions = this.getVersions();
1176
+ this.updateDocPhase();
1177
+ this.selectedSidebarValue = window.location.pathname;
1178
+ }
1177
1179
  }
1178
1180
 
1179
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
  }