@salesforcedevs/docs-components 0.56.2-seo-test5 → 0.56.2-seo-test6
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
|
@@ -451,11 +451,14 @@ export default class AmfReference extends LightningElement {
|
|
|
451
451
|
|
|
452
452
|
items.forEach((item) => {
|
|
453
453
|
item.methods?.forEach((method) => {
|
|
454
|
+
const title =
|
|
455
|
+
this.getTitleForLabel(method.label) || method.method;
|
|
454
456
|
const meta = this.addToMetadata(
|
|
455
457
|
parentReferencePath,
|
|
456
458
|
referenceId,
|
|
457
459
|
"method",
|
|
458
|
-
method
|
|
460
|
+
method,
|
|
461
|
+
title
|
|
459
462
|
);
|
|
460
463
|
methodList.push(
|
|
461
464
|
Object.assign(method, {
|
|
@@ -463,8 +466,7 @@ export default class AmfReference extends LightningElement {
|
|
|
463
466
|
parentReferencePath,
|
|
464
467
|
meta
|
|
465
468
|
),
|
|
466
|
-
label:
|
|
467
|
-
this.getTitleForLabel(method.label) || method.method
|
|
469
|
+
label: title
|
|
468
470
|
})
|
|
469
471
|
);
|
|
470
472
|
});
|
|
@@ -509,7 +511,8 @@ export default class AmfReference extends LightningElement {
|
|
|
509
511
|
parentReferencePath,
|
|
510
512
|
referenceId,
|
|
511
513
|
type,
|
|
512
|
-
summary
|
|
514
|
+
summary,
|
|
515
|
+
label
|
|
513
516
|
);
|
|
514
517
|
children.push({
|
|
515
518
|
label,
|
|
@@ -582,7 +585,8 @@ export default class AmfReference extends LightningElement {
|
|
|
582
585
|
parentReferencePath,
|
|
583
586
|
referenceId,
|
|
584
587
|
type,
|
|
585
|
-
topic
|
|
588
|
+
topic,
|
|
589
|
+
label
|
|
586
590
|
);
|
|
587
591
|
return {
|
|
588
592
|
label: topic.label,
|
|
@@ -611,7 +615,8 @@ export default class AmfReference extends LightningElement {
|
|
|
611
615
|
parentReferencePath: string,
|
|
612
616
|
referenceId: string,
|
|
613
617
|
type: string,
|
|
614
|
-
topic: { id: string; domId: string }
|
|
618
|
+
topic: { id: string; domId: string },
|
|
619
|
+
navTitle: string
|
|
615
620
|
): string | undefined {
|
|
616
621
|
const { urlIdentifer, prefix } = URL_CONFIG[type];
|
|
617
622
|
|
|
@@ -629,7 +634,8 @@ export default class AmfReference extends LightningElement {
|
|
|
629
634
|
amfId: topic.id,
|
|
630
635
|
elementId: topic.domId,
|
|
631
636
|
identifier,
|
|
632
|
-
type
|
|
637
|
+
type,
|
|
638
|
+
navTitle
|
|
633
639
|
};
|
|
634
640
|
}
|
|
635
641
|
return meta;
|
|
@@ -935,46 +941,56 @@ export default class AmfReference extends LightningElement {
|
|
|
935
941
|
}
|
|
936
942
|
|
|
937
943
|
/**
|
|
938
|
-
* Finds and returns referenceUrl if given topic url matches
|
|
944
|
+
* Finds and returns referenceUrl and topicTitle if given topic url matches
|
|
939
945
|
*/
|
|
940
|
-
|
|
946
|
+
getReferenceDetailsInGivenTopics(
|
|
941
947
|
topics: ParsedMarkdownTopic[],
|
|
942
948
|
topicMeta: string
|
|
943
|
-
): string {
|
|
949
|
+
): { referenceUrl: string; topicTitle: string } {
|
|
944
950
|
let referenceUrl = "";
|
|
951
|
+
let topicTitle = "";
|
|
945
952
|
for (let i = 0; i < topics.length; i++) {
|
|
946
953
|
const topic = topics[i];
|
|
947
954
|
const meta = this.getMarkdownReferenceMeta(topic.link.href);
|
|
948
955
|
const childTopics = topic.children;
|
|
949
956
|
if (meta === topicMeta) {
|
|
950
957
|
referenceUrl = topic.link.href;
|
|
958
|
+
topicTitle = topic.label;
|
|
951
959
|
} else if (childTopics && childTopics.length) {
|
|
952
|
-
|
|
960
|
+
const referenceDetails = this.getReferenceDetailsInGivenTopics(
|
|
953
961
|
childTopics,
|
|
954
962
|
topicMeta
|
|
955
963
|
);
|
|
964
|
+
referenceUrl = referenceDetails.referenceUrl;
|
|
965
|
+
topicTitle = referenceDetails.topicTitle;
|
|
956
966
|
}
|
|
957
|
-
if (referenceUrl) {
|
|
967
|
+
if (referenceUrl && topicTitle) {
|
|
958
968
|
break;
|
|
959
969
|
}
|
|
960
970
|
}
|
|
961
|
-
return
|
|
971
|
+
return {
|
|
972
|
+
referenceUrl,
|
|
973
|
+
topicTitle
|
|
974
|
+
};
|
|
962
975
|
}
|
|
963
976
|
|
|
964
977
|
/**
|
|
965
|
-
* Gives referenceUrl for given markdown topic url
|
|
978
|
+
* Gives referenceUrl and topicTitle for given markdown topic url
|
|
966
979
|
*/
|
|
967
|
-
|
|
980
|
+
getRefDetailsForGivenTopicMeta(
|
|
968
981
|
referenceId: string,
|
|
969
982
|
topicMeta: string
|
|
970
|
-
): string | undefined {
|
|
983
|
+
): { referenceUrl: string; topicTitle: string } | undefined {
|
|
971
984
|
const amfConfig = this.getAmfConfigWithId(referenceId);
|
|
972
|
-
let
|
|
985
|
+
let referenceDetails;
|
|
973
986
|
if (amfConfig) {
|
|
974
987
|
const topics = amfConfig.topic?.children || [];
|
|
975
|
-
|
|
988
|
+
referenceDetails = this.getReferenceDetailsInGivenTopics(
|
|
989
|
+
topics,
|
|
990
|
+
topicMeta
|
|
991
|
+
);
|
|
976
992
|
}
|
|
977
|
-
return
|
|
993
|
+
return referenceDetails;
|
|
978
994
|
}
|
|
979
995
|
|
|
980
996
|
/**
|
|
@@ -1030,6 +1046,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1030
1046
|
referenceId,
|
|
1031
1047
|
"summary"
|
|
1032
1048
|
);
|
|
1049
|
+
this.updateNavTitleMetaTag(selectedItemMetaData.navTitle);
|
|
1033
1050
|
}
|
|
1034
1051
|
|
|
1035
1052
|
if (selectedItemMetaData) {
|
|
@@ -1045,15 +1062,17 @@ export default class AmfReference extends LightningElement {
|
|
|
1045
1062
|
selectedItemMetaData.parentReferencePath,
|
|
1046
1063
|
selectedItemMetaData.meta
|
|
1047
1064
|
);
|
|
1065
|
+
this.updateNavTitleMetaTag(selectedItemMetaData.navTitle);
|
|
1048
1066
|
}
|
|
1049
1067
|
});
|
|
1050
1068
|
} else {
|
|
1051
1069
|
let invalidTopicReferenceUrl = "";
|
|
1052
1070
|
if (topicId) {
|
|
1053
|
-
const
|
|
1071
|
+
const referenceDetails = this.getRefDetailsForGivenTopicMeta(
|
|
1054
1072
|
referenceId,
|
|
1055
1073
|
topicId
|
|
1056
1074
|
);
|
|
1075
|
+
const selectedItemUrl = referenceDetails?.referenceUrl;
|
|
1057
1076
|
if (!selectedItemUrl) {
|
|
1058
1077
|
invalidTopicReferenceUrl = previousRefUrlInSession;
|
|
1059
1078
|
}
|
|
@@ -1083,6 +1102,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1083
1102
|
|
|
1084
1103
|
private loadMarkdownBasedReference(referenceUrl?: string): void {
|
|
1085
1104
|
let referenceId = "";
|
|
1105
|
+
let topicTitle;
|
|
1086
1106
|
const currentUrl = window.location.href;
|
|
1087
1107
|
if (this.isProjectRootPath()) {
|
|
1088
1108
|
/**
|
|
@@ -1109,10 +1129,12 @@ export default class AmfReference extends LightningElement {
|
|
|
1109
1129
|
*/
|
|
1110
1130
|
const referenceMeta = this.getMarkdownReferenceMeta(referenceUrl);
|
|
1111
1131
|
const selectedItemRefId = this.getReferenceIdFromUrl(referenceUrl);
|
|
1112
|
-
const
|
|
1132
|
+
const referenceDetails = this.getRefDetailsForGivenTopicMeta(
|
|
1113
1133
|
selectedItemRefId,
|
|
1114
1134
|
referenceMeta
|
|
1115
1135
|
);
|
|
1136
|
+
const selectedItemUrl = referenceDetails?.referenceUrl;
|
|
1137
|
+
topicTitle = referenceDetails?.topicTitle;
|
|
1116
1138
|
if (!selectedItemUrl) {
|
|
1117
1139
|
referenceId = this.getReferenceIdFromUrl(referenceUrl);
|
|
1118
1140
|
}
|
|
@@ -1125,6 +1147,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1125
1147
|
const childrenItems = amfConfig.topic.children;
|
|
1126
1148
|
if (childrenItems.length > 0) {
|
|
1127
1149
|
redirectReferenceUrl = childrenItems[0].link.href;
|
|
1150
|
+
topicTitle = childrenItems[0].label;
|
|
1128
1151
|
}
|
|
1129
1152
|
}
|
|
1130
1153
|
if (redirectReferenceUrl) {
|
|
@@ -1138,6 +1161,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1138
1161
|
}
|
|
1139
1162
|
}
|
|
1140
1163
|
|
|
1164
|
+
this.updateNavTitleMetaTag(topicTitle);
|
|
1141
1165
|
this.versions = this.getVersions();
|
|
1142
1166
|
|
|
1143
1167
|
this.updateDocPhase();
|
|
@@ -1155,6 +1179,15 @@ export default class AmfReference extends LightningElement {
|
|
|
1155
1179
|
);
|
|
1156
1180
|
}
|
|
1157
1181
|
|
|
1182
|
+
private updateNavTitleMetaTag(navTitle = ""): void {
|
|
1183
|
+
// this is required to update the nav title meta tag.
|
|
1184
|
+
// eslint-disable-next-line @lwc/lwc/no-document-query
|
|
1185
|
+
const metaNavTitle = document.querySelector('meta[name="nav-title"]');
|
|
1186
|
+
if (metaNavTitle && navTitle) {
|
|
1187
|
+
metaNavTitle.setAttribute("content", navTitle);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1158
1191
|
onNavSelect(event: CustomEvent): void {
|
|
1159
1192
|
const name = event.detail.name;
|
|
1160
1193
|
if (name) {
|
|
@@ -1190,6 +1223,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1190
1223
|
metaVal
|
|
1191
1224
|
);
|
|
1192
1225
|
this.updateUrlWithSelected(parentReferencePath, metaVal);
|
|
1226
|
+
this.updateNavTitleMetaTag(metadata.navTitle);
|
|
1193
1227
|
} else {
|
|
1194
1228
|
if (this.isParentReferencePath(name)) {
|
|
1195
1229
|
this.loadNewReferenceItem(name);
|