Lance O. Posted April 9, 2018 Share Posted April 9, 2018 I've built a site that uses parent pages as the "container" for child pages: Parent page [page.php] -- Child page [unit-child-a.php] -- Child page [unit-child-b.php] ---- Grandchild page [subunit-grandchild-a.php] ---- Grandchild page [subunit-grandchild-b.php] -- Child page [unit-child-c.php] The child pages are displayed as content on the corresponding parent page using the render method. Some child pages also include their own child pages. (Internally the child page template names start with "unit-" and the grandchild page template names start with "subunit-".) Example: foreach ($page->children("template=template-name,sort=sort") as $child) echo $child->render(); This approach allows content administrators to add and reorder child pages as necessary, but I've come across an issue that I'm not sure how to address. The site includes search functionality, but when a visitor searches for content and it is found in a child or grandchild page, the Parent page should be the one that is displayed in the search results, since the child and grandchild pages are not directly viewable. Since some searches could include more than one child or grandchild page of a parent page, this sometimes means that a parent page could be included more than once. How do I easily redirect the child and grandchild pages to the parent page, and only include the parent page once in the search results? Link to comment Share on other sites More sharing options...
kongondo Posted April 9, 2018 Share Posted April 9, 2018 A recent similar topic...Maybe the suggested approaches there will help? 2 Link to comment Share on other sites More sharing options...
Lance O. Posted April 12, 2018 Author Share Posted April 12, 2018 Thanks @kongondo! That post helped. 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