fast and minimal static site generator
ssg
at master 910 B view raw
1package types 2 3const ( 4 BuildDir = "build" 5 PagesDir = "pages" 6 TemplatesDir = "templates" 7 StaticDir = "static" 8) 9 10type File interface { 11 Ext() string 12 // Render takes any arbitrary data and combines that with the global config, 13 // page frontmatter and the body, as template params. Templates are read 14 // from types.TemplateDir and the final html is written to dest, 15 // with necessary directories being created. 16 Render(dest string, data interface{}, drafts bool) error 17 18 // Frontmatter will not be populated if Render hasn't been called. 19 Frontmatter() map[string]any 20 // Body will not be populated if Render hasn't been called. 21 Body() string 22 Basename() string 23} 24 25// Only used for building indexes and Atom feeds 26type Post struct { 27 Meta map[string]any 28 // HTML-formatted body of post 29 Body string 30 // Whether this post should be shown (based on draft status and drafts flag) 31 Allowed bool 32}