Shorten ->url() only to pagename

Hello again :smile:,

I build a onepager with Kirby and now I need a ankermenu.

echo $page->url()

gives me the hole url but in my solution I need it without the uri so that I can write

      <a href="#<?php echo $page->url() ?>"><?php echo $page->title()->html() ?></a>

Or have anbody a better solution to build this kind of menu?

Kind regards

I usually use sth. like this:

<a href="<?php echo url() . '/#' . $page->uid() ?>"><?php echo $page->title()->html() ?></a>
1 Like