How To Make a Page Link To a Child Page

Sometimes when creating sites with mojoPortal content management system you may have pages that have no content of their own and really just serve as a parent page for other pages. An example on this site is the Documentation Page, which is really just a parent page for all the documentation. If there are lots of child pages you could enable the "Show Child Page Site Map" setting on the page so it just shows links of all its child pages as we have done on the Documentation page. However if there are only 1 or 2 pages, people often ask how they can make the parent page just link directly to the child page. To do this, follow these instructions:

  1. Find out the pageid of the child page by visiting the child page then click the Page Settings link and see the pageid in the url, make note of this pageid
  2. Go to Administration> Advanced Tools > Url Manager and find the url for the parent page
  3. Click the edit icon, using expert manual entry mode, change the real url for the parent page so it points to the pageid of the child page instead of it's own id

Now when you click the parent page it goes directly to the child page. The only tricky part is now getting to the page settings of the parent page if you want to change it again. The solution is to use the  Administration > Add/Edit Pages page which shows the whole site hierarchy, from there you can select the parent page in the list and then click the gear icon to get to Page Settings.

A Javascript Solution

If you want a page to redirect to another page, another alternative is to add an html content feature on the parent page and put in javascript to redirect to the child. You would enter this in the source view of the editor:

<script type="text/javascript">
location.href = 'http://yoursiteroot/cyourhildpageurl.aspx';

A Redirect Solution

You could use a 301 redirect to redirect from the parent page url to the child page url. However since 301 redirects are permanent and you may later change your mind and want the parent page to work as a normal page, it is best to use a disposable url for the parent page. For example if the child page url is ~/child-page.aspx you could use an url like ~/redirect-to-child-page.aspx for the parent page. Then setup a 301 redirect from ~/redirect-to-child-page.aspx to ~/child-page.aspx. That way if you later decide the parent page should not redirect you can just give it a new url that doesn't redirect. The advantage of the redirect solution is that it keeps the menu selection highlighted correctly.

See Also

Last Updated 2012-03-19 by Joe Audette