Created
November 4, 2014 13:59
-
-
Save ryanlewis/b34c9171ce8fd9efe5d1 to your computer and use it in GitHub Desktop.
Redirect to Parent page template
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
@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