protected override string InternalHandler(HttpContext context, TargetSite target, string targetRootDir, string requestedPath, ViewModel vm) { string sitemapPath; if (target.HasCustomLayout) { sitemapPath = Path.Combine(targetRootDir, Constants.LayoutFolderName, Constants.SitemapFileName); } else { sitemapPath = Path.Combine(Session.GetInstance().WebRoot, Constants.LayoutFolderName, Constants.SitemapFileName); } if (!File.Exists(sitemapPath)) { throw new InvalidOperationException(String.Format("Sitemap template file for '{0}' is missing. It should be at '{1}'", target.Name, sitemapPath)); } vm.Sitemap = this.BuildSitemap(targetRootDir); SparkRenderer renderer = new SparkRenderer(); string sitemapOutput = renderer.Render(sitemapPath, vm); vm.MarkdownHtml = sitemapOutput; string output = renderer.Render(target.TemplateFile, vm); return output; }
protected override string InternalHandler(HttpContext context, TargetSite target, string targetRootDir, string requestedPath, ViewModel vm) { string mdFilePath = String.Format("{0}.md", Path.Combine(targetRootDir, requestedPath)); vm.MarkdownHtml = MarkdownHelper.ProcessMarkdown(MarkdownHelper.GetMarkdown(mdFilePath)); SparkRenderer renderer = new SparkRenderer(); string output = renderer.Render(target.TemplateFile, vm); return output; }