Chris FP Posted November 15, 2021 Share Posted November 15, 2021 Hi all, new to the forum and to ProcessWire. I've been spending some time looking into documentation and the available forum questions previously posted but I cannot seem to get it to work. I suspect it's probably a combination of the template not living off the root and that the child is 2 levels down. Below is code I've added to _init.php wire()->addHookBefore('Page::path', function($event) { $page = $event->object; if($page->template == 'portfolio-single-page') { // ensure that pages with template 'post' live off the root rather than '/posts/' $event->replace = true; $event->return = "/$page->name/"; } }); The structure of my page is as follows FULL PAGE URL - /our-projects/video-commercials/aerial-photography-videography/ /our-projects/ - portfolio-page.php /our-projects/video-commercials/ - portfolio-category-page.php /our-projects/video-commercials/aerial-photography-videography/ - portfolio-single-page.php Right now I want to simply remove the parents from the child url and have /our-projects/video-commercials/aerial-photography-videography/ go to /aerial-photography-videography/ (unique) Is this possible? Link to comment Share on other sites More sharing options...
virtualgadjo Posted November 16, 2021 Share Posted November 16, 2021 hi, even if i must say i find this a curious idea which sounds so much like a wordpress idea it hurts ? you'll find the working answer in deltavik post in the last thread you quotemore, as a visitor, i really prefer a clear url that makes me know where i am in the website structure and avoids the need of breadcrumbs disfiguring the pages ? pw not being wp you don't have to avoid default structure url as post, portfolio and so on, you can name your pages the way you want giving your visitors a good idea of what and where they are strolling in, a better UX than a simple domain with everything not organized following (not to speak about SEO...) have a nice day 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