diff --git a/modules/setting/setting.go b/modules/setting/setting.go index e1d3d87b0..308300586 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -88,6 +88,9 @@ var ( AppDataPath string AppWorkPath string + // User settings + GoogleAnalyticsID string + // Server settings Protocol Scheme Domain string @@ -695,6 +698,7 @@ func NewContext() { sec := Cfg.Section("server") AppName = Cfg.Section("").Key("APP_NAME").MustString("Gitea: Git with a cup of tea") + GoogleAnalyticsID = Cfg.Section("").Key("GOOGLE_ANALYTICS_ID").String() Protocol = HTTP if sec.Key("PROTOCOL").String() == "https" { diff --git a/modules/templates/helper.go b/modules/templates/helper.go index ae7d86ed9..6ec7cff00 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -61,6 +61,9 @@ func NewFuncMap() []template.FuncMap { "DisableGravatar": func() bool { return setting.DisableGravatar }, + "GoogleAnalyticsID": func() string { + return setting.GoogleAnalyticsID + }, "ShowFooterTemplateLoadTime": func() bool { return setting.ShowFooterTemplateLoadTime }, diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index fb9611cb6..e193dcffb 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -105,6 +105,17 @@ +{{if .GoogleAnalyticsID}} + + + +{{end}} {{if .PageIsUserProfile}} @@ -265,6 +276,9 @@ {{.i18n.Tr "sign_in"}} + + {{.i18n.Tr "sign_in_with"}}   + {{end}}