Get current page url for share button

Hi,

I’ve searched in the forum and on the Kirby guide but can’t seem to find what I need. So essentially, I want Kirby to grab the current page url so I can pass it on to my share button. So people can share my pages.

Here is my current code for sharing the pages. Hopefully there is a way to pass the current page URL to it.

<div class="uk-panel uk-margin-xlarge-top uk-margin-2xlarge-top@m">
    <ul class="uk-subnav uk-margin-large-top uk-margin-xlarge-top@m">
        <li><?php echo t('partager') ?>:</li>
        <li><a href="https://facebook.com/sharer/sharer.php?u=https://unistudio.co/html/dannel/pages/freelancer-single-service.html"><i class="brand-facebook uk-icon-small"><span class="sr-only">Facebook Icon</span></i></a></li>
        <li><a href="https://twitter.com/share?url=https://unistudio.co/html/dannel/pages/freelancer-single-service.html&text=Brand Strategy"><i class="brand-twitter uk-icon-small"><span class="sr-only">Twitter Icon</span></i></a></li>
        <li><a href="https://www.linkedin.com/sharing/share-offsite/?url=https://unistudio.co/html/dannel/pages/freelancer-single-post.html"><i class="brand-linkedin uk-icon-small"><span class="sr-only">Linkedin Icon</span></i></a></li>
    </ul>
</div>

Thanks,

You can grab the current’s page URL with $page->url(). See https://getkirby.com/docs/reference/objects/cms/page/url.

See also: Quicktip: Simple share buttons | Kirby CMS

Thanks!

Works flawlessly. Thank you!