Skip to content

Commit 4574e50

Browse files
committed
Hide glossary tooltips on version home pages
1 parent 029ec37 commit 4574e50

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/components/GlossaryInjector.tsx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,33 @@ const GlossaryInjector: React.FC<GlossaryInjectorProps> = ({ children }) => {
3030
.catch((err) => console.error('Failed to load glossary:', err));
3131
}, []);
3232

33+
// Function to check if the current page is a version index page
34+
const isVersionIndexPage = () => {
35+
if (typeof window !== 'undefined') {
36+
const path = window.location.pathname;
37+
38+
// Check for various version index patterns
39+
// English versions
40+
if (path.match(/\/docs\/latest\/?$/) ||
41+
path.match(/\/docs\/latest\/index(\.html)?/) ||
42+
path.match(/\/docs\/[0-9]+\.[0-9]+\/?$/) ||
43+
path.match(/\/docs\/[0-9]+\.[0-9]+\/index(\.html)?/)) {
44+
return true;
45+
}
46+
47+
// Japanese versions
48+
if (path.match(/\/ja-jp\/docs\/latest\/?$/) ||
49+
path.match(/\/ja-jp\/docs\/latest\/index(\.html)?/) ||
50+
path.match(/\/ja-jp\/docs\/[0-9]+\.[0-9]+\/?$/) ||
51+
path.match(/\/ja-jp\/docs\/[0-9]+\.[0-9]+\/index(\.html)?/)) {
52+
return true;
53+
}
54+
}
55+
return false;
56+
};
57+
3358
useEffect(() => {
34-
if (Object.keys(glossary).length === 0) return;
59+
if (Object.keys(glossary).length === 0 || isVersionIndexPage()) return;
3560

3661
// Sort terms in descending order by length to prioritize multi-word terms.
3762
const terms = Object.keys(glossary).sort((a, b) => b.length - a.length);

0 commit comments

Comments
 (0)