So far, I am fetching a content by id and works fine.
var footerSection = Umbraco.TypedContent(1174);
Although, I am trying to have the same result by querying via document alias and it is not working:
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
var foundFooterSection = umbracoHelper.TypedContentAtRoot().FirstOrDefault(x => x.DocumentTypeAlias == "footerSection");
I am pretty sure that document alias is "footerSection" - I have this information even from the first (successful) call but it returns null.
Any reasons that might cause this?
Any help is welcome!
Your footer node is probably a descendant of root so you probably need to adjust the code a little bit.
var foundFooterSection = umbracoHelper
.TypedContentAtRoot()
.SelectMany(root => root.Descendants())
.Where(x => x.DocumentTypeAlias == "footerSection")
.ToList();