private void LoadAndRenderContentItemFromFile(ContentItem contentItem, string filePath)
        {
            var fileInfo = new FileInfo(filePath);

            contentItem.CreatedDate = fileInfo.CreationTimeUtc;
            contentItem.LocalPath = filePath;

            //Load raw content with metadata
            var content = File.ReadAllText(filePath);
            var metaHeaders = ReadYamlHeader(content);
            content = ExcludeYamlHeader(content);


            var shopifyContext = _liquidEngine.WorkContext.ToShopifyModel(_liquidEngine.UrlBuilder);
            var parameters = shopifyContext.ToLiquid() as Dictionary<string, object>;
            parameters.Add("settings", _liquidEngine.GetSettings());
            //Render content by liquid engine
            content = _liquidEngine.RenderTemplate(content, parameters);

            //Render markdown content
            if (String.Equals(Path.GetExtension(filePath), ".md", StringComparison.InvariantCultureIgnoreCase))
            {
                content = _markdownRender.Transform(content);
            }


            contentItem.LoadContent(content, metaHeaders);
        }
 //Called from SEO route by page permalink
 public ActionResult GetContentPage(ContentItem page)
 {
     var blogArticle = page as BlogArticle;
     var contentPage = page as ContentPage;
     if (blogArticle != null)
     {
         base.WorkContext.CurrentBlogArticle = blogArticle;
         base.WorkContext.CurrentBlog = base.WorkContext.Blogs.Where(x => x.Name.Equals(blogArticle.BlogName, StringComparison.OrdinalIgnoreCase)).SingleOrDefault();
         return View("article", page.Layout, base.WorkContext);
     }
     else
     {
         base.WorkContext.CurrentPage = contentPage;
         return View("page", page.Layout, base.WorkContext);
     }
 }
        private void LoadAndRenderContentItem(string contentPath, ContentItem contentItem)
        {
            string content = null;
            using (var stream = _contentBlobProvider.OpenRead(contentPath))
        {
            //Load raw content with metadata
                content = stream.ReadToString();
            }
            IDictionary<string, IEnumerable<string>> metaHeaders = null;
            IDictionary themeSettings = null;
            try
            {
                metaHeaders = ReadYamlHeader(content);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("Failed to read yaml header from \"{0}\"", contentItem.StoragePath), ex);
            }

            content = RemoveYamlHeader(content);

            var workContext = _workContextFactory();
            if (workContext != null)
            {
                var shopifyContext = workContext.ToShopifyModel(_urlBuilderFactory());
                var parameters = shopifyContext.ToLiquid() as Dictionary<string, object>;
              
                themeSettings = _liquidEngine.GetSettings();
                parameters.Add("settings", themeSettings);
                //Render content by liquid engine
                content = _liquidEngine.RenderTemplate(content, parameters);
            }

            //Render markdown content
            if (string.Equals(Path.GetExtension(contentItem.StoragePath), ".md", StringComparison.InvariantCultureIgnoreCase))
            {
                content = _markdownRender.Transform(content);
            }


            contentItem.LoadContent(content, metaHeaders, themeSettings);
        }