I have added umbracoRedirect property to my document type, setting it to a Content Picker, and as expected it redirects the page when you try to land on it. Good stuff :D
But I have a content block that renders out a list of pages and would like to use the umbracoRedirect value to render the Url of where Umbraco would redirect the user to if they went direct to the page in question i.e.
Now... I can get the UmbracoRedirect value thusly:
var umbracoRedirect = department.Value<Udi>("umbracoRedirect");
var url = department.Url();
if (umbracoRedirect != null)
{
var redirect = UmbracoContext.Content.GetById(umbracoRedirect);
if(redirect != null)
{
url = redirect.Url();
}
}
But that's an ugly addition for me to add to where ever I want to do this (which I could wrap up in an extension method...) but surely this would be nicer as part of the object generation and not me making another call to the cache.
Is there something I am missing in a setting somewhere for ModelsBuilder?
UmbracoRedirect is null
Hey,
I have added umbracoRedirect property to my document type, setting it to a Content Picker, and as expected it redirects the page when you try to land on it. Good stuff :D
But I have a content block that renders out a list of pages and would like to use the umbracoRedirect value to render the Url of where Umbraco would redirect the user to if they went direct to the page in question i.e.
but unfortunately UmbracoRedirect is null.
Now... I can get the UmbracoRedirect value thusly:
But that's an ugly addition for me to add to where ever I want to do this (which I could wrap up in an extension method...) but surely this would be nicer as part of the object generation and not me making another call to the cache.
Is there something I am missing in a setting somewhere for ModelsBuilder?
is working on a reply...