Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-05-23 13:26:10 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-05-23 17:52:08 +0300
commit9ad46a20357a7e28b405feef5c8f7d4501186da6 (patch)
tree18034f49654b236429dd804b4f1f0a84f7a1787d /config
parent4256de3392d320a5a47fcab49882f2a3249c2163 (diff)
Add instagram_simple shortcode
Fixes #4748
Diffstat (limited to 'config')
-rw-r--r--config/privacy/privacyConfig.go4
-rw-r--r--config/privacy/privacyConfig_test.go4
-rw-r--r--config/services/servicesConfig.go9
-rw-r--r--config/services/servicesConfig_test.go3
4 files changed, 20 insertions, 0 deletions
diff --git a/config/privacy/privacyConfig.go b/config/privacy/privacyConfig.go
index 4da7efbea..ee7b7be2c 100644
--- a/config/privacy/privacyConfig.go
+++ b/config/privacy/privacyConfig.go
@@ -53,6 +53,10 @@ type GoogleAnalytics struct {
// Instagram holds the privacy configuration settings related to the Instagram shortcode.
type Instagram struct {
Service `mapstructure:",squash"`
+
+ // If simple mode is enabled, a static and no-JS version of the Instagram
+ // image card will be built.
+ Simple bool
}
// SpeakerDeck holds the privacy configuration settings related to the SpeakerDeck shortcode.
diff --git a/config/privacy/privacyConfig_test.go b/config/privacy/privacyConfig_test.go
index bca53f167..f945ac8c2 100644
--- a/config/privacy/privacyConfig_test.go
+++ b/config/privacy/privacyConfig_test.go
@@ -36,6 +36,7 @@ disable = true
respectDoNotTrack = true
[privacy.instagram]
disable = true
+simple = true
[privacy.speakerDeck]
disable = true
[privacy.tweet]
@@ -45,6 +46,7 @@ disable = true
[privacy.youtube]
disable = true
privacyEnhanced = true
+simple = true
`
cfg, err := config.FromConfigString(tomlConfig, "toml")
assert.NoError(err)
@@ -57,12 +59,14 @@ privacyEnhanced = true
assert.True(pc.GoogleAnalytics.Disable)
assert.True(pc.GoogleAnalytics.RespectDoNotTrack)
assert.True(pc.Instagram.Disable)
+ assert.True(pc.Instagram.Simple)
assert.True(pc.SpeakerDeck.Disable)
assert.True(pc.Tweet.Disable)
assert.True(pc.Vimeo.Disable)
assert.True(pc.YouTube.PrivacyEnhanced)
assert.True(pc.YouTube.Disable)
+ assert.True(pc.YouTube.Simple)
}
func TestDecodeConfigFromTOMLCaseInsensitive(t *testing.T) {
diff --git a/config/services/servicesConfig.go b/config/services/servicesConfig.go
index 676174a56..d78b80948 100644
--- a/config/services/servicesConfig.go
+++ b/config/services/servicesConfig.go
@@ -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)
diff --git a/config/services/servicesConfig_test.go b/config/services/servicesConfig_test.go
index 96ef839a1..69dec0350 100644
--- a/config/services/servicesConfig_test.go
+++ b/config/services/servicesConfig_test.go
@@ -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.