@salesforcedevs/docs-components 1.17.2-accessfix-alpha1 → 1.17.5-alpha1
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
|
@@ -237,6 +237,8 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
237
237
|
this.updateSearchInput(nextSearchParam);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
+
|
|
241
|
+
this.addMetatags();
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
disconnectedCallback(): void {
|
|
@@ -531,7 +533,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
531
533
|
}
|
|
532
534
|
|
|
533
535
|
this.docContent = data.content;
|
|
534
|
-
this.addMetatags();
|
|
535
536
|
this.setState({
|
|
536
537
|
isFetchingDocument: false
|
|
537
538
|
});
|
|
@@ -553,7 +554,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
553
554
|
|
|
554
555
|
if (data) {
|
|
555
556
|
this.docContent = data.content;
|
|
556
|
-
this.addMetatags();
|
|
557
557
|
|
|
558
558
|
if (!this.pageReference.hash) {
|
|
559
559
|
document.body.scrollIntoView();
|
|
@@ -721,6 +721,9 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
721
721
|
}
|
|
722
722
|
|
|
723
723
|
addMetatags(): void {
|
|
724
|
+
if (!this.docContent) {
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
724
727
|
const div = document.createElement("div");
|
|
725
728
|
div.innerHTML = DOMPurify.sanitize(this.docContent);
|
|
726
729
|
const docDescription = div.querySelector(".shortdesc")?.textContent;
|
|
@@ -784,15 +787,18 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
784
787
|
// Doc id without version id is always considered latest and should be used for SEO.
|
|
785
788
|
// Condition is to find a docId which includes version id,
|
|
786
789
|
// these docs are always considered as old and should not be indexed including the preview docs.
|
|
790
|
+
const metaTag = document.querySelector('meta[name="robots"]');
|
|
787
791
|
if (
|
|
788
792
|
headTag.length &&
|
|
789
|
-
docId?.includes(versionId)
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
793
|
+
docId?.includes(versionId)) {
|
|
794
|
+
if (!metaTag) {
|
|
795
|
+
const robotsMeta = document.createElement("meta");
|
|
796
|
+
robotsMeta.setAttribute("name", "robots");
|
|
797
|
+
robotsMeta.setAttribute("content", "noindex, follow");
|
|
798
|
+
headTag[0].appendChild(robotsMeta);
|
|
799
|
+
}
|
|
800
|
+
} else if(metaTag) {
|
|
801
|
+
metaTag.remove();
|
|
796
802
|
}
|
|
797
803
|
}
|
|
798
804
|
|