Skip to content

Commit c7612d1

Browse files
authored
Remove meta tags theme-color and default-theme (#24960)
As discussed in #24953 (comment). ## ⚠️ BREAKING ⚠️ 1. The `ui.THEME_COLOR_META_TAG` setting has been removed. If you still need to set the `theme-color` meta tag, add it via `$GITEA_CUSTOM/templates/custom/header.tmpl` instead. 2. The non-standard `default-theme` meta-tag added in #13809 has been removed. Third party code that needs to obtain the currently loaded theme should use the `theme-<name>` class on the `<html>` node instead, which reflect the currently active theme.
1 parent faf8557 commit c7612d1

File tree

7 files changed

+3
-15
lines changed

7 files changed

+3
-15
lines changed

custom/conf/app.example.ini

-4
Original file line numberDiff line numberDiff line change
@@ -1180,10 +1180,6 @@ LEVEL = Info
11801180
;; Number of line of codes shown for a code comment
11811181
;CODE_COMMENT_LINES = 4
11821182
;;
1183-
;; Value of `theme-color` meta tag, used by some mobile browers for chrome and
1184-
;; out-of-viewport areas. Default is unset which uses body color.
1185-
;THEME_COLOR_META_TAG =
1186-
;;
11871183
;; Max size of files to be displayed (default is 8MiB)
11881184
;MAX_DISPLAY_FILE_SIZE = 8388608
11891185
;;

docs/content/doc/administration/config-cheat-sheet.en-us.md

-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ The following configuration set `Content-Type: application/vnd.android.package-a
221221
- `SHOW_USER_EMAIL`: **true**: Whether the email of the user should be shown in the Explore Users page.
222222
- `THEMES`: **auto,gitea,arc-green**: All available themes. Allow users select personalized themes.
223223
regardless of the value of `DEFAULT_THEME`.
224-
- `THEME_COLOR_META_TAG`: **\<empty\>**: Value of `theme-color` meta tag, used by some mobile browsers for chrome and out-of-viewport areas. Default is unset which uses body color.
225224
- `MAX_DISPLAY_FILE_SIZE`: **8388608**: Max size of files to be displayed (default is 8MiB)
226225
- `REACTIONS`: All available reactions users can choose on issues/prs and comments
227226
Values can be emoji alias (:smile:) or a unicode emoji.

modules/setting/ui.go

-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ var UI = struct {
2222
GraphMaxCommitNum int
2323
CodeCommentLines int
2424
ReactionMaxUserNum int
25-
ThemeColorMetaTag string
2625
MaxDisplayFileSize int64
2726
ShowUserEmail bool
2827
DefaultShowFullName bool
@@ -77,7 +76,6 @@ var UI = struct {
7776
GraphMaxCommitNum: 100,
7877
CodeCommentLines: 4,
7978
ReactionMaxUserNum: 10,
80-
ThemeColorMetaTag: ``,
8179
MaxDisplayFileSize: 8388608,
8280
DefaultTheme: `auto`,
8381
Themes: []string{`auto`, `gitea`, `arc-green`},

modules/templates/helper.go

-3
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ func NewFuncMap() template.FuncMap {
118118
"CustomEmojis": func() map[string]string {
119119
return setting.UI.CustomEmojisMap
120120
},
121-
"ThemeColorMetaTag": func() string {
122-
return setting.UI.ThemeColorMetaTag
123-
},
124121
"MetaAuthor": func() string {
125122
return setting.UI.Meta.Author
126123
},

templates/base/head.tmpl

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
<meta name="viewport" content="width=device-width, initial-scale=1">
55
<title>{{if .Title}}{{.Title | RenderEmojiPlain}} - {{end}}{{if .Repository.Name}}{{.Repository.Name}} - {{end}}{{AppName}}</title>
66
{{if .ManifestData}}<link rel="manifest" href="data:{{.ManifestData}}">{{end}}
7-
{{if ThemeColorMetaTag}}<meta name="theme-color" content="{{ThemeColorMetaTag}}">{{end}}
8-
<meta name="default-theme" content="{{DefaultTheme}}">
97
<meta name="author" content="{{if .Repository}}{{.Owner.Name}}{{else}}{{MetaAuthor}}{{end}}">
108
<meta name="description" content="{{if .Repository}}{{.Repository.Name}}{{if .Repository.Description}} - {{.Repository.Description}}{{end}}{{else}}{{MetaDescription}}{{end}}">
119
<meta name="keywords" content="{{MetaKeywords}}">
@@ -63,7 +61,7 @@
6361
<meta property="og:description" content="{{MetaDescription}}">
6462
{{end}}
6563
<meta property="og:site_name" content="{{AppName}}">
66-
{{template "base/stylesheets" .}}
64+
{{template "base/head_style" .}}
6765
{{template "custom/header" .}}
6866
</head>
6967
<body>
File renamed without changes.

templates/status/500.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<title>Internal Server Error - {{AppName}}</title>
1212
<link rel="icon" href="{{AssetUrlPrefix}}/img/favicon.svg" type="image/svg+xml">
1313
<link rel="alternate icon" href="{{AssetUrlPrefix}}/img/favicon.png" type="image/png">
14-
{{template "base/stylesheets" .}}
14+
{{template "base/head_style" .}}
1515
</head>
1616
<body>
1717
<div class="full height">
@@ -28,7 +28,7 @@
2828
<div role="main" class="page-content status-page-500">
2929
<p class="gt-mt-5 center"><img src="{{AssetUrlPrefix}}/img/500.png" alt="Internal Server Error"></p>
3030
<div class="ui divider"></div>
31-
<div class="ui container gt-mt-5">
31+
<div class="ui container gt-my-5">
3232
{{if .ErrorMsg}}
3333
<p>{{.locale.Tr "error.occurred"}}:</p>
3434
<pre class="gt-whitespace-pre-wrap gt-break-all">{{.ErrorMsg}}</pre>

0 commit comments

Comments
 (0)