Skip to content

Commit 2ec160e

Browse files
committed
docs: banner fix
1 parent b879212 commit 2ec160e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

website/src/theme/DocSidebar/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ import React, { useEffect, useRef } from 'react';
22
import { useColorMode } from '@docusaurus/theme-common';
33
import OriginalDocSidebar from '@theme-original/DocSidebar';
44

5+
function reload() {
6+
if (typeof ethicalads !== 'undefined') {
7+
ethicalads.reload();
8+
} else {
9+
setTimeout(reload, 300);
10+
}
11+
}
12+
513
export default function DocSidebar(props) {
614
const bannerRef = useRef();
715
const { colorMode } = useColorMode();
@@ -16,7 +24,7 @@ export default function DocSidebar(props) {
1624
banner.setAttribute('data-ea-publisher', 'react-chartjs-2jsorg');
1725
banner.setAttribute('data-ea-type', 'image');
1826
document.querySelector('.theme-doc-sidebar-menu')?.parentElement?.appendChild(banner);
19-
ethicalads.reload();
27+
reload();
2028
}
2129
}, []);
2230

0 commit comments

Comments
 (0)