Skip to content

Commit 77bb21b

Browse files
committed
remove hreflang from APi-doc page
1 parent 8feb0dc commit 77bb21b

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

src/pages/api-doc/index.jsx

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,28 @@ import React, { useState, useEffect } from 'react';
22
import Layout from '@theme/Layout';
33
import Tabs from '@theme/Tabs';
44
import TabItem from '@theme/TabItem';
5-
import { useLocation } from 'react-router-dom';
65

76

87

98

109

1110

1211
function ApiDoc() {
13-
const location = useLocation();
1412
useEffect(() => {
15-
console.log(location.pathname)
16-
if (location.pathname === '/support/api-doc/') {
17-
const removeAlternateLinks = () => {
18-
const alternateLinks = document.querySelectorAll('link[rel="alternate"]');
19-
alternateLinks.forEach(link => link.parentNode.removeChild(link));
20-
};
21-
22-
removeAlternateLinks();
23-
24-
const observer = new MutationObserver((mutationsList) => {
25-
for (const mutation of mutationsList) {
26-
if (mutation.type === 'childList') {
27-
removeAlternateLinks();
28-
}
13+
const linkTag = ['link[rel="alternate"]'];
14+
function addRoleAndTabIndexAttributes() {
15+
linkTag.forEach(link => {
16+
let alternateLinks = document.querySelectorAll(link);
17+
console.log("in loop", alternateLinks)
18+
for (let i = 0; i < alternateLinks.length; i++) {
19+
const element = alternateLinks[i];
20+
element.remove();
2921
}
30-
});
31-
32-
observer.observe(document.body, { childList: true, subtree: true });
33-
34-
return () => observer.disconnect();
22+
23+
})
3524
}
36-
}, [location.pathname]);
25+
addEventListener('load', addRoleAndTabIndexAttributes);
26+
}, []);
3727
return (
3828
<Layout title="LambdaTest API Documentation"
3929
description="Manage and organize your test builds, test sessions, tunnel status and more with LambdaTest APIs for Selenium automation, App automation, Smart UI automation and Automated screenshots. ">

0 commit comments

Comments
 (0)