kirby-navigation icon indicating copy to clipboard operation
kirby-navigation copied to clipboard

Highlight active menu item

Open LordCanis opened this issue 2 years ago • 1 comments

Hey,

thanks for the awesome plugin. Is it possible to highlight the active menu item?

I use:

<?php foreach($site->navigation()->toStructure() as $navigation): ?>
  <li>
    <a <?php e($navigation->isOpen(), 'aria-current') ?> id="<?php echo $navigation->id() ?>"  href="<?php echo $navigation->url(); ?>" <?php echo $navigation->popup()->toBool() ? 'rel="noopener noreferrer" target="_blank"' : '' ?>>
  <?php echo $navigation->text() ?>
    </a>
  </li>
 <?php endforeach ?>

and insert in the a-Tag this

<?php e($navigation->isOpen(), 'aria-current') ?>

Than all items are highlighted. What am I doing wrong?

Thanks for your help!

LordCanis avatar May 20 '22 12:05 LordCanis

@LordCanis felt on the same issue, a workaround was given in this issue #18 in the last comment, it worked for me with kirby 3.7.3 with the navigation plugin version 3.0.0

Sean-OShea avatar Aug 17 '22 13:08 Sean-OShea