before publish and after publish commands
This commit is contained in:
16
hugo.go
16
hugo.go
@@ -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") != "" {
|
||||
|
||||
Reference in New Issue
Block a user