Esempio n. 1
0
        public PageDataItem(PageData child)
        {
            var ibBasePage = child as IB_OrdinaryPage;

            if (ibBasePage != null)
            {
                Description = ibBasePage.Ingress;
            }
            else
            {
                var propertyValue = child.GetPropertyValue("MainBody");

                if (propertyValue != null)
                {
                    var htmlDoc = new HtmlDocument();
                    htmlDoc.LoadHtml(propertyValue);
                    var node = htmlDoc.DocumentNode.SelectSingleNode("//p");

                    if (node != null)
                    {
                        if (node.InnerText.Length > 400)
                        {
                            Description = node.InnerText.Substring(0, 400) + " ...";
                        }
                        else
                        {
                            Description = node.InnerText;
                        }
                    }
                }
            }

            Title = child.PageName;

            var urlResolver = ServiceLocator.Current.GetInstance <UrlResolver>();
            var url         = urlResolver.GetVirtualPath(child.ContentLink).GetUrl();

            Id            = child.ContentGuid;
            Link          = url;
            PublishedDate = child.StartPublish;
            IsExternal    = false;
        }