1
0
Fork 0

Add [other].SHOW_FOOTER_POWERED_BY setting to hide Powered by (#30253)

This allows you to hide the "Powered by" text in footer via
`SHOW_FOOTER_POWERED_BY` flag in configuration.

---------

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 609a627a44dbcb7b630ff51ce9f4b9f448b48ca8)

Conflicts:
	- docs/content/administration/config-cheat-sheet.en-us.md
	- docs/content/administration/config-cheat-sheet.zh-cn.md
	  Removed both, they're Gitea specific.
	- templates/base/footer_content.tmpl
	  Applied the change manually, keeping the Forgejo footer.
This commit is contained in:
Yakov 2024-04-03 09:01:50 -07:00 committed by Gergely Nagy
parent 0eb2105b16
commit b0ff1a17a4
No known key found for this signature in database
4 changed files with 10 additions and 1 deletions

View file

@ -2331,6 +2331,8 @@ LEVEL = Info
;SHOW_FOOTER_VERSION = true ;SHOW_FOOTER_VERSION = true
;; Show template execution time in the footer ;; Show template execution time in the footer
;SHOW_FOOTER_TEMPLATE_LOAD_TIME = true ;SHOW_FOOTER_TEMPLATE_LOAD_TIME = true
;; Show the "powered by" text in the footer
;SHOW_FOOTER_POWERED_BY = true
;; Generate sitemap. Defaults to `true`. ;; Generate sitemap. Defaults to `true`.
;ENABLE_SITEMAP = true ;ENABLE_SITEMAP = true
;; Enable/Disable RSS/Atom feed ;; Enable/Disable RSS/Atom feed

View file

@ -8,6 +8,7 @@ import "code.gitea.io/gitea/modules/log"
type OtherConfig struct { type OtherConfig struct {
ShowFooterVersion bool ShowFooterVersion bool
ShowFooterTemplateLoadTime bool ShowFooterTemplateLoadTime bool
ShowFooterPoweredBy bool
EnableFeed bool EnableFeed bool
EnableSitemap bool EnableSitemap bool
} }
@ -15,6 +16,7 @@ type OtherConfig struct {
var Other = OtherConfig{ var Other = OtherConfig{
ShowFooterVersion: true, ShowFooterVersion: true,
ShowFooterTemplateLoadTime: true, ShowFooterTemplateLoadTime: true,
ShowFooterPoweredBy: true,
EnableSitemap: true, EnableSitemap: true,
EnableFeed: true, EnableFeed: true,
} }

View file

@ -109,6 +109,9 @@ func NewFuncMap() template.FuncMap {
"ShowFooterTemplateLoadTime": func() bool { "ShowFooterTemplateLoadTime": func() bool {
return setting.Other.ShowFooterTemplateLoadTime return setting.Other.ShowFooterTemplateLoadTime
}, },
"ShowFooterPoweredBy": func() bool {
return setting.Other.ShowFooterPoweredBy
},
"AllowedReactions": func() []string { "AllowedReactions": func() []string {
return setting.UI.Reactions return setting.UI.Reactions
}, },

View file

@ -1,6 +1,8 @@
<footer class="page-footer" role="group" aria-label="{{ctx.Locale.Tr "aria.footer"}}"> <footer class="page-footer" role="group" aria-label="{{ctx.Locale.Tr "aria.footer"}}">
<div class="left-links" role="contentinfo" aria-label="{{ctx.Locale.Tr "aria.footer.software"}}"> <div class="left-links" role="contentinfo" aria-label="{{ctx.Locale.Tr "aria.footer.software"}}">
<a target="_blank" rel="noopener noreferrer" href="https://forgejo.org">{{ctx.Locale.Tr "powered_by" "Forgejo"}}</a> {{if ShowFooterPoweredBy}}
<a target="_blank" rel="noopener noreferrer" href="https://forgejo.org">{{ctx.Locale.Tr "powered_by" "Forgejo"}}</a>
{{end}}
{{if (or .ShowFooterVersion .PageIsAdmin)}} {{if (or .ShowFooterVersion .PageIsAdmin)}}
{{ctx.Locale.Tr "version"}}: {{ctx.Locale.Tr "version"}}:
{{if .IsAdmin}} {{if .IsAdmin}}