예제 #1
0
        public override ActionResult Index(RenderModel model)
        {
            var allSections            = model.Content.Children.ToList();
            var listOfSectionsToRender = _sectionsProvider.GetListOfSectionsToRender(allSections);
            var pageViewModel          = new PageViewModel {
                Sections = listOfSectionsToRender
            };

            pageViewModel = _pageModelExtender.ApplyLayoutToModel(pageViewModel, model.Content);
            var rootNodes        = _nodeHelper.Umbraco.TypedContentAtRoot();
            var websiteNode      = rootNodes.First(x => x.DocumentTypeAlias == "master");
            var articleViewModel = pageViewModel.ExtendToArticleViewModel(model.Content, websiteNode);
            var image            = model.Content.GetImage("cardImage", _nodeHelper).WithQuality(75).WithHeight(160).WithWidth(330).WithCrop();
            var request          = HttpContext.Request;
            var domainurl        = string.Format("{0}://{1}", request.Url.Scheme, request.Url.Authority);

            articleViewModel.ArticleImgUrl = domainurl + image.Url;

            articleViewModel.Image       = model.Content.GetImage("cardImage", _nodeHelper).WithQuality(75).WithHeight(400).WithWidth(1170).WithCrop();
            articleViewModel.PublishedOn = model.Content.CreateDate;
            return(View("Article", articleViewModel));
        }