Created
August 24, 2011 15:55
-
-
Save leekelleher/1168374 to your computer and use it in GitHub Desktop.
Umbraco template to redirect the current page/node to its first child page/node.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Master Language="C#" MasterPageFile="~/masterpages/BlankTemplate.master" AutoEventWireup="true" %> | |
<script runat="server"> | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
var current = umbraco.NodeFactory.Node.GetCurrent(); | |
if (current != null) | |
{ | |
var child = current.ChildrenAsList.FirstOrDefault(); | |
if (child != null) | |
{ | |
var url = child.Url; | |
if (!string.IsNullOrEmpty(url)) | |
{ | |
Response.Redirect(url, true); | |
return; | |
} | |
} | |
} | |
Response.Redirect("/", true); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment