@salesforcedevs/docs-components 0.56.2-seo-test5 → 0.56.2-seo-test8
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
|
+
topic.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,19 +1062,33 @@ 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
|
}
|
|
1060
1079
|
}
|
|
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
|
+
}
|
|
1061
1092
|
this.loadMarkdownBasedReference(invalidTopicReferenceUrl);
|
|
1062
1093
|
}
|
|
1063
1094
|
}
|
|
@@ -1109,10 +1140,11 @@ export default class AmfReference extends LightningElement {
|
|
|
1109
1140
|
*/
|
|
1110
1141
|
const referenceMeta = this.getMarkdownReferenceMeta(referenceUrl);
|
|
1111
1142
|
const selectedItemRefId = this.getReferenceIdFromUrl(referenceUrl);
|
|
1112
|
-
const
|
|
1143
|
+
const referenceDetails = this.getRefDetailsForGivenTopicMeta(
|
|
1113
1144
|
selectedItemRefId,
|
|
1114
1145
|
referenceMeta
|
|
1115
1146
|
);
|
|
1147
|
+
const selectedItemUrl = referenceDetails?.referenceUrl;
|
|
1116
1148
|
if (!selectedItemUrl) {
|
|
1117
1149
|
referenceId = this.getReferenceIdFromUrl(referenceUrl);
|
|
1118
1150
|
}
|
|
@@ -1155,6 +1187,15 @@ export default class AmfReference extends LightningElement {
|
|
|
1155
1187
|
);
|
|
1156
1188
|
}
|
|
1157
1189
|
|
|
1190
|
+
private updateNavTitleMetaTag(navTitle = ""): void {
|
|
1191
|
+
// this is required to update the nav title meta tag.
|
|
1192
|
+
// eslint-disable-next-line @lwc/lwc/no-document-query
|
|
1193
|
+
const metaNavTitle = document.querySelector('meta[name="nav-title"]');
|
|
1194
|
+
if (metaNavTitle && navTitle) {
|
|
1195
|
+
metaNavTitle.setAttribute("content", navTitle);
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1158
1199
|
onNavSelect(event: CustomEvent): void {
|
|
1159
1200
|
const name = event.detail.name;
|
|
1160
1201
|
if (name) {
|
|
@@ -1190,6 +1231,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1190
1231
|
metaVal
|
|
1191
1232
|
);
|
|
1192
1233
|
this.updateUrlWithSelected(parentReferencePath, metaVal);
|
|
1234
|
+
this.updateNavTitleMetaTag(metadata.navTitle);
|
|
1193
1235
|
} else {
|
|
1194
1236
|
if (this.isParentReferencePath(name)) {
|
|
1195
1237
|
this.loadNewReferenceItem(name);
|