mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
@@ -29,6 +29,7 @@ const (
|
||||
type Config struct {
|
||||
Disqus Disqus
|
||||
GoogleAnalytics GoogleAnalytics
|
||||
Instagram Instagram
|
||||
}
|
||||
|
||||
// Disqus holds the functional configuration settings related to the Disqus template.
|
||||
@@ -43,6 +44,14 @@ type GoogleAnalytics struct {
|
||||
ID string
|
||||
}
|
||||
|
||||
// Instagram holds the functional configuration settings related to the Instagram shortcodes.
|
||||
type Instagram struct {
|
||||
// The Simple variant of the Instagram is decorated with Bootstrap 4 card classes.
|
||||
// This means that if you use Bootstrap 4 or want to provide your own CSS, you want
|
||||
// to disable the inline CSS provided by Hugo.
|
||||
DisableInlineCSS bool
|
||||
}
|
||||
|
||||
func DecodeConfig(cfg config.Provider) (c Config, err error) {
|
||||
m := cfg.GetStringMap(servicesConfigKey)
|
||||
|
||||
|
@@ -33,6 +33,8 @@ someOtherValue = "foo"
|
||||
shortname = "DS"
|
||||
[services.googleAnalytics]
|
||||
id = "ga_id"
|
||||
[services.instagram]
|
||||
disableInlineCSS = true
|
||||
`
|
||||
cfg, err := config.FromConfigString(tomlConfig, "toml")
|
||||
assert.NoError(err)
|
||||
@@ -44,6 +46,7 @@ id = "ga_id"
|
||||
assert.Equal("DS", config.Disqus.Shortname)
|
||||
assert.Equal("ga_id", config.GoogleAnalytics.ID)
|
||||
|
||||
assert.True(config.Instagram.DisableInlineCSS)
|
||||
}
|
||||
|
||||
// Support old root-level GA settings etc.
|
||||
|
Reference in New Issue
Block a user