Hey all,
Adding on to Methods for URL Cloaking/Redirecting? - #3 by kuwts as the translation does not seem to be working for this solution. Two solutions that I tried are setting the translation in the page model with the lang code:
$language = $kirby->language();
$lang_code = $language->code();
public function cloakedUrl() {
return url($lang_code . 'redirect/' . $this->id());
}
as well as in the routes in config.php:
'routes' => [
[
'pattern' => 'redirect/(:all)',
'action' => function ($uri) {
if ($page = page($uri) ) {
go($page->translation()->ref_url());
}
}
]
]
Not too sure if it’s simply a syntax issue and this would be set another way, or if it is something else. Any insight is much appreciated, thanks