From 5d417ce5ff4d93b48433e13a94279d5b4185087a Mon Sep 17 00:00:00 2001 From: Viktor Nagy Date: Mon, 10 Feb 2025 10:34:12 +0100 Subject: [PATCH] use useHomePageRoute hook to properly detect homepage instead of manual path comparison --- src/theme/Root.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/theme/Root.tsx b/src/theme/Root.tsx index ab3417469e..721a911b1c 100644 --- a/src/theme/Root.tsx +++ b/src/theme/Root.tsx @@ -1,13 +1,17 @@ import React from 'react'; import Berry from '../components/Berry'; import { useLocation } from '@docusaurus/router'; +import { useHomePageRoute } from '@docusaurus/theme-common/internal'; export default function Root({ children }: { children: React.ReactNode }) { const location = useLocation(); + const homePageRoute = useHomePageRoute(); + const isHomePage = homePageRoute?.path === location.pathname; + return ( <> {children} - {location.pathname !== '/' && } + {!isHomePage && } ); }