before publish and after publish commands

This commit is contained in:
Henrique Dias committed 2016-12-18 12:40:56 +00:00
1 parent 76c91576cf
commit af8dbc2180
2 files changed
+33 -7

No files matched your search

+16
View File
@@ -101,7 +101,23 @@ func (h Hugo) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
}
if r.Header.Get("Regenerate") == "true" {
if err = h.Config.BeforePublish(
r,
&h.FileManager.Configs[0],
h.FileManager.Configs[0].User,
); err != nil {
return http.StatusInternalServerError, err
}
RunHugo(h.Config, false)
if err = h.Config.AfterPublish(
r,
&h.FileManager.Configs[0],
h.FileManager.Configs[0].User,
); err != nil {
return http.StatusInternalServerError, err
}
}
if r.Header.Get("Schedule") != "" {