announcementBar on homepage only #10075
-
Hi, Is there a way to configure the I used this nice feature to display the message "If you like Juno, star it on GitHub!" on the related website, but I feel it would also be nice to also not display it when browsing the documentation. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can swizzle the const {pathname} = useLocation()
const isHomePage = pathname === "/"
if (!isHomePage) {
return null;
} Or you can swizzle You can also hide it with CSS, although it will remain in the DOM tree on pages that don't need it. As you can see, you have many options to do that 😄 |
Beta Was this translation helpful? Give feedback.
You can swizzle the
@theme/AnnouncementBar
component and make it render null/false when it's not on the homepage.Or you can swizzle
@theme/Layout
, add a prop such asnoAnnouncementBar={true}
to hide it conditionally, or using the location pathname like above.You can also hide it with CSS, although it will remain in the DOM tree on pages that don't need it.
As you can see, you have many options to do that 😄