hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit c7d5f9f067fd6a37ac6b75cb1c02259debd3ff21
parent bfebd8c02cfc0d4e4786e0f64932d832d3976e92
Author: Paul van Brouwershaven <vanbroup@users.noreply.github.com>
Date:   Fri,  3 Jun 2022 21:37:50 +0200

resources: Register MediaTypes before build

Fixes #9971
Diffstat:
Mcommands/hugo.go | 6++++++
Mcommands/server.go | 4----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git 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
@@ -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 {