public string Run(string content, SiteContent page, RazorRenderer razorRenderer, Site site) { this.Content = content; this.Model = new DynamicValue(page); this.InitGatsbyRazorTemplate(razorRenderer, site); return this.ExecuteTemplate(); }
public string LayoutContent(string layoutName, string content, SiteContent page, Site site) { if (!this.layouts.ContainsKey(layoutName)) throw new GatsbyException(string.Format("Layout \"{0}\" was not found.", layoutName)); var layout = this.layouts[layoutName]; try { content = layout.Run(content, page, this, site); } catch (Exception ex) { throw new GatsbyException(string.Format("Failed while rendering layout \"{0}\":\n\t{1}", layoutName, ex.Message)); } if (string.IsNullOrEmpty(layout.Parent)) return content; return this.LayoutContent(layout.Parent, content, page, site); }
private void WriteContent(Config config, SiteContent page, Site site) { string content = page.Content; if (!string.IsNullOrEmpty(page.Layout)) content = this.razorRenderer.LayoutContent(page.Layout, content, page, site); string destination = Path.Combine(config.Destination, page.Permalink); string directory = Path.GetDirectoryName(destination); if (!string.IsNullOrEmpty(directory)) Directory.CreateDirectory(directory); File.WriteAllText(destination, content); }
private void SetDefaultsForContent(SiteContent content) { if (content.LastUpdate == null) content.LastUpdate = content.Date; }
public string GetUrl(SiteContent content) { return "http://zacharysnow.net/" + content.Permalink; }