From f1c35628add05442f8370213872cfaaa4f7e1a6b Mon Sep 17 00:00:00 2001 From: surishubham Date: Thu, 19 Sep 2024 14:39:33 +0530 Subject: [PATCH] removed extra hreflang attribute tag - IN-9472 --- src/pages/api-doc/index.jsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/pages/api-doc/index.jsx b/src/pages/api-doc/index.jsx index 547883e5f..58704f74e 100644 --- a/src/pages/api-doc/index.jsx +++ b/src/pages/api-doc/index.jsx @@ -9,6 +9,22 @@ import TabItem from '@theme/TabItem'; function ApiDoc() { + useEffect(() => { + const removeAlternateLinks = () => { + const alternateLinks = document.querySelectorAll('link[rel="alternate"]'); + alternateLinks.forEach(link => link.parentNode.removeChild(link)); + }; + removeAlternateLinks(); + const observer = new MutationObserver((mutationsList) => { + for (const mutation of mutationsList) { + if (mutation.type === 'childList') { + removeAlternateLinks(); + } + } + }); + observer.observe(document.body, { childList: true, subtree: true }); + return () => observer.disconnect(); + }, []); return (