public static string GetLogoUrl(this UmbracoHelper src, IPublishedContent currentPage)
        {
            var mediaId = currentPage.GetPropertyValue <string>("logo", true);

            if (string.IsNullOrEmpty(mediaId))
            {
                mediaId = src.GetHomePage().GetPropertyValue <string>("logo");
            }

            return(src.TypedMedia(mediaId).Url);
        }
Beispiel #2
0
        protected override IPublishedContent FindContent(RequestContext requestContext, UmbracoContext umbracoContext)
        {
            var productId     = requestContext.RouteData.Values["id"].ToString();
            var umbracoHelper = new UmbracoHelper(umbracoContext);
            var homePage      = umbracoHelper.GetHomePage();

            // look for pages with a matching productId
            var productPages = homePage.Children(f => f.HasProperty("productId") && f.HasValue("productId") && f.GetPropertyValue <string>("productId") == productId);
            var productPage  = productPages.FirstOrDefault();

            if (productPage != null)
            {
                return(productPage);
            }

            return(homePage);
        }
        protected override IPublishedContent FindContent(RequestContext requestContext, UmbracoContext umbracoContext)
        {
            var umbracoHelper = new UmbracoHelper(umbracoContext);

            return(umbracoHelper.GetHomePage());
        }