summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPaul van Brouwershaven <[email protected]>2022-06-03 21:37:50 +0200
committerGitHub <[email protected]>2022-06-03 21:37:50 +0200
commitc7d5f9f067fd6a37ac6b75cb1c02259debd3ff21 (patch)
treee2f83861c54ac9ac3224773f27e7a5f185b789de
parentbfebd8c02cfc0d4e4786e0f64932d832d3976e92 (diff)
downloadhugo-c7d5f9f067fd6a37ac6b75cb1c02259debd3ff21.tar.gz
hugo-c7d5f9f067fd6a37ac6b75cb1c02259debd3ff21.zip
resources: Register MediaTypes before build
Fixes #9971
-rw-r--r--commands/hugo.go6
-rw-r--r--commands/server.go4
2 files changed, 6 insertions, 4 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index c61e64185..f10fec00b 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -127,6 +127,12 @@ func initializeConfig(mustHaveConfigFile, failOnInitErr, running bool,
return nil, err
}
+ if h := c.hugoTry(); h != nil {
+ for _, s := range h.Sites {
+ s.RegisterMediaTypes()
+ }
+ }
+
return c, nil
}
diff --git a/commands/server.go b/commands/server.go
index ff8fe4cd2..f082164ce 100644
--- a/commands/server.go
+++ b/commands/server.go
@@ -272,10 +272,6 @@ func (sc *serverCmd) server(cmd *cobra.Command, args []string) error {
return err
}
- for _, s := range c.hugo().Sites {
- s.RegisterMediaTypes()
- }
-
// Watch runs its own server as part of the routine
if sc.serverWatch {