Skip to content

Instantly share code, notes, and snippets.

@ryanlewis
Created November 4, 2014 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanlewis/b34c9171ce8fd9efe5d1 to your computer and use it in GitHub Desktop.
Save ryanlewis/b34c9171ce8fd9efe5d1 to your computer and use it in GitHub Desktop.
Redirect to Parent page template
@inherits UmbracoTemplatePage
@{
var parent = Model.Content.Parent;
while (true)
{
if (parent.TemplateId > 0 && parent.TemplateId != Model.Content.TemplateId)
{
break;
}
parent = parent.Parent;
}
Response.RedirectPermanent(parent.Url());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment