cjx2240 Posted October 30, 2020 Share Posted October 30, 2020 Hello Following a few guides on removing parent urls, and multilingual site setups, I have create multiple homepages for my website. For the parent language however, I've removed the parent name from the URL using the following in ready.php (mashed together from some other threads - on a side note please let me know if this is a terrible approach) wire()->addHookBefore('Page::path', function($event) { $page = $event->object; if($page->rootParent(1057)) { $event->replace = true; $parents = "/"; foreach($page->parents() as $parent) { if($parent->id != 1 && $parent->id != 1057) { $parents .= "$parent->name/"; } } $event->return = $parents.$page->name."/"; } }); There's more to it than this, but I think this is the relevant part. And it's working great everywhere, except when it comes to rendering pagination [edit: within a repeater matrix, I should mention], for which my URLs are doubling up when they render, like so: /parent/page/parent/page/page2 Any ideas how I can prevent this would be greatly appreciated. Link to comment Share on other sites More sharing options...
Zeka Posted October 30, 2020 Share Posted October 30, 2020 Do you use MarkupPagerNav module? If so, there is 'baseUrl' property where probably you should pass your modified page URL 1 Link to comment Share on other sites More sharing options...
cjx2240 Posted October 31, 2020 Author Share Posted October 31, 2020 Hey thanks for the idea, weirdly I set the baseUrl to a blank string, and that fixed it. I can't say I'm satisfied with understanding where things went wrong, but at least I can move forward for now! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now