resources: Register MediaTypes before build

Fixes #9971
This commit is contained in:
Paul van Brouwershaven 2022-06-03 21:37:50 +02:00 committed by GitHub
parent bfebd8c02c
commit c7d5f9f067
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -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
}

View file

@ -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 {