Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #80: add Google Analytics to templates #97

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ var (
RunUser string
IsWindows bool
HasRobotsTxt bool
Google struct {
GATrackingID string
}
)

// DateLang transforms standard language locale name to corresponding value in datetime plugin.
Expand Down Expand Up @@ -592,6 +595,7 @@ please consider changing to GITEA_CUSTOM`)
ShowFooterBranding = Cfg.Section("other").Key("SHOW_FOOTER_BRANDING").MustBool()
ShowFooterVersion = Cfg.Section("other").Key("SHOW_FOOTER_VERSION").MustBool()
ShowFooterTemplateLoadTime = Cfg.Section("other").Key("SHOW_FOOTER_TEMPLATE_LOAD_TIME").MustBool()
Google.GATrackingID = Cfg.Section("other").Key("GA_TRACKING_ID").String()

HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
}
Expand Down
3 changes: 3 additions & 0 deletions modules/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ func NewFuncMap() []template.FuncMap {
}
return "tab-size-8"
},
"GATrackingID": func() string {
return setting.Google.GATrackingID
},
}}
}

Expand Down