On my Gatsby website, I have a main header, for most pages, and a SpecialHeader for specific pages.
In my Layout file, which holds the header, page children, footer, etc, I have added this condition:
        {location.pathname === ('/special-page/' || '/special-page') ? (
          <SpecialHeader currentPathname={location.pathname} />
        ) : (
          <MainHeader currentPathname={location.pathname} />
        )}
I would like to only show the SpecialHeader for pages that include the path /special-page. Is there a better way to do this?
There will be additional subpages (/special-page/foo) that will need the same header. Is it possible to show the special header if only the /special-page path is present? For example something like /special-page*
I hope I make sense. Thanks in advance for any advice.
 
    