return err
}
-func (s *Site) render(name string, d interface{}, renderBuffer *bytes.Buffer, layouts ...string) error {
+func (s *Site) render(name string, d interface{}, w io.Writer, layouts ...string) error {
layout, found := s.findFirstLayout(layouts...)
if found == false {
jww.WARN.Printf("Unable to locate layout for %s: %s\n", name, layouts)
return nil
}
- if err := s.renderThing(d, layout, renderBuffer); err != nil {
+ if err := s.renderThing(d, layout, w); err != nil {
// Behavior here should be dependent on if running in server or watch mode.
distinctErrorLogger.Printf("Error while rendering %s: %v", name, err)
if !s.Running() {
package tpl
import (
- "bytes"
"fmt"
"github.com/eknkc/amber"
bp "github.com/spf13/hugo/bufferpool"
return ExecuteTemplateToHTML(context, "partials/"+name, "theme/partials/"+name)
}
-func ExecuteTemplate(context interface{}, buffer *bytes.Buffer, layouts ...string) {
+func ExecuteTemplate(context interface{}, w io.Writer, layouts ...string) {
worked := false
for _, layout := range layouts {
}
if localTemplates.Lookup(name) != nil {
- err := localTemplates.ExecuteTemplate(buffer, name, context)
+ err := localTemplates.ExecuteTemplate(w, name, context)
if err != nil {
jww.ERROR.Println(err, "in", name)
}