I am working on a multi-language website and have to manually build
url() for some links.
I tried to use this syntax to build the first part of the URL
but the result I get is
I realised it is because what I get is a collection of pages, but is it possible to only extract its
A collection does not have a URL, what exactly are you trying to do?
UPDATE, found a simple solution even though it is semantically hacky? I just added
->first() as the collection with that
template only has one page and several subpages.
$places = $site->children()->filterBy('template', 'places')->first();
<a href="<?php echo $places->url() . '/' . str::slug($page->location()->html()) ?>">
In this way also the url is automatically translated into the two languages.
findBy() returns a single page.
$places = $site->children()->findBy('template', 'places');
Great! Even better, I thought that should have been an easier simpler command.