Hi, i’m struggling trying to output the page url from a page field, it’s from a structure field on the site wide template, im trying to display CTA button in the navbar from the menu snippet, and the bit of code to output the “ctalink” page field looks like that :
<?php echo $navcta["ctalink"]; ?>
if i select a page from the page field, for example projects/project-a, it outputs “projects/project-a” in the HTML, and the website seems to add the "localhost/website/, but the link is only valid from the homepage as its seems to add projects/project-a ton whatever URL it has been clicked…
How can i simply output the absolute URL of my internal page?
It might be over kill for what you want but i do CTA links via a kirby route to get a list of every page on the site, and using that as an option list on a select field. This saves you having to store the links in a structure feild, and is completly dynamic.
The route will look something like this (im using AutoID but should be easy enough to switch this to UID or something):