Navigation of multi-site


#1

I’m attempting to segregate sites into multiple sites. I’ve converted the node to a site, and everything works great when I’m viewing the site outside the editor. However, when navigating within the admin panel, it includes the top-level parent in the navigation (/Geo/about-us, for example, instead of just /about-us). I have the following for my navigation code:

<?php
if(\Pimcore\Model\Site::isSiteRequest()) {
    $site = \Pimcore\Model\Site::getCurrentSite();
    $mainNavStartNode = $site->getRootDocument();
} else {
    $mainNavStartNode = \Pimcore\Model\Document::getById(93);
}
?>
				
<div class="navigation-header responsive-menu-toggle-class">
    <div class="title">Navigation</div>
        <div class="close-menu"></div>
    </div>
    <div class="nav-overflow">
        <nav style="padding:0px; max-width:100%;">
        <?php
                $mainNavigation = $this->navigation()->buildNavigation($document, $mainNavStartNode);
                $mainNavigation->addPage([
                    'order' => -1, // put it in front of all the others
                    'uri' => '/', //path to homepage
                    'label' => 'home', //visible label
                    'title' => 'Homepage' //tooltip text
                ]);

                echo $this->navigation()->render($mainNavigation, 'menu', 'renderMenu', [
                    'maxDepth' => 1,
                    'ulClass'  => ''
                ]);
            ?>

#2

We normally set the main nav node as property in documents - as can be seen in demo basic and here.

Because inside admin panel it will never be a site request…

BR
Christian