First Child Redirect is a plugin for the Structure module. It allows you to redirect to the first child page of any parent entry in a Structure tree.
Example usage: Unzip the attached plugin file and move it to /system/plugins/
Create a blank template called ‘first_child_redirect’ and enter the tag below in it: {exp:first_child_redirect}
Now you can assign the template to any parent page within your Structure tree, and the page will automatically redirect to it’s first child page. For example:
/about/
Could redirect to:
/about/overview/
Please note that caching should NOT be enabled for the first_child_redirect template.
Compatible with Structure v1.3.1.
EDIT: updated to version 0.5
Thanks so much for making this.
Occasionally, we have clients who don’t want to use the toplevel page that is created in Structure (e.g., “/about/”), but want the first page under “/about/” to be the main page for the “/about/” section. Before, we’ve often had to hard code the navigation to accommodate that request, but this looks like a much better way.
It does however, assume that the index was removedErm, you’ve lost me there - what index would that be?
Sure. Current site I’m working on with plugin:
http://siteurlhere.com/about/founder/but actual URL is
http://siteurlhere.com/index.php/about/founder/I’m no programmer but it looks like your using the “site_url” and then adding the structure path. So “site_index” is ignored.
I see - you can change line 71 of the plugin to:Does that work for you?header("Location:".$site_url.'/'.$PREFS->ini('site_index').ltrim($first_child_uri,'/'));
Really close, missing the slash before the index:
http://siteurlhere.comindex.php/about/founder/I do have the closing slash in my site url:
http://siteurlhere.com/First of all this plugin really helps as I am always getting clients wanting to contain pages in a section and not realising they have nothing to say on the top level page. All redirects fine.
However when I do a search and click on the resulting links all work fine (I have the correct paths in the settings for the search) except the first child which has the redirect applied. When I click on the link in the search results page it goes to the correct url but the content showing is for the parent container page.
All help much appreciated. Not sure if it is Structure of the redirect plugin.
thanks
Brian
I’m not sure what the search module does to the urls it generates (not used it yet 😊 ) however a workaround might be to exclude the specific entries that are acting as containers. Give these entries a new status, say “hidden”, and then add status=“not hidden” to your search form tag.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.