mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
@@ -20,6 +20,7 @@ import (
|
||||
"github.com/gobwas/glob"
|
||||
"github.com/gohugoio/hugo/config"
|
||||
hglob "github.com/gohugoio/hugo/hugofs/glob"
|
||||
"github.com/gohugoio/hugo/media"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
@@ -31,7 +32,8 @@ type deployConfig struct {
|
||||
Matchers []*matcher
|
||||
Order []string
|
||||
|
||||
ordering []*regexp.Regexp // compiled Order
|
||||
ordering []*regexp.Regexp // compiled Order
|
||||
mediaTypes media.Types
|
||||
}
|
||||
|
||||
type target struct {
|
||||
@@ -108,7 +110,12 @@ func (m *matcher) Matches(path string) bool {
|
||||
|
||||
// decode creates a config from a given Hugo configuration.
|
||||
func decodeConfig(cfg config.Provider) (deployConfig, error) {
|
||||
var dcfg deployConfig
|
||||
|
||||
var (
|
||||
mediaTypesConfig []map[string]interface{}
|
||||
dcfg deployConfig
|
||||
)
|
||||
|
||||
if !cfg.IsSet(deploymentConfigKey) {
|
||||
return dcfg, nil
|
||||
}
|
||||
@@ -134,5 +141,14 @@ func decodeConfig(cfg config.Provider) (deployConfig, error) {
|
||||
}
|
||||
dcfg.ordering = append(dcfg.ordering, re)
|
||||
}
|
||||
|
||||
if cfg.IsSet("mediaTypes") {
|
||||
mediaTypesConfig = append(mediaTypesConfig, cfg.GetStringMap("mediaTypes"))
|
||||
}
|
||||
|
||||
dcfg.mediaTypes, err = media.DecodeTypes(mediaTypesConfig...)
|
||||
if err != nil {
|
||||
return dcfg, err
|
||||
}
|
||||
return dcfg, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user