You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that all template directories are relative to the CustomPath configuration, not a custom directory inside it (#14399)
* Note that all template directories are relative to the `CustomPath` configuration, not a `custom` directory inside it.
This is a minor clarification, which makes locating where the templates need to be much easier
* Note that it's possible to read the `GITEA_CUSTOM` value from the admin
* Use "$GITEA_CUSTOM" as placeholder
It's more obvious it's a variable and not a typo
Copy file name to clipboardExpand all lines: docs/content/doc/advanced/customizing-gitea.en-us.md
+28-27Lines changed: 28 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ the Linux Filesystem Standard. Gitea will attempt to create required folders, in
30
30
`custom/`. Distributions may provide a symlink for `custom` using `/etc/gitea/`.
31
31
32
32
Application settings can be found in file `CustomConf` which is by default,
33
-
`CustomPath/conf/app.ini` but may be different if your build has set this differently.
33
+
`$GITEA_CUSTOM/conf/app.ini` but may be different if your build has set this differently.
34
34
Again `gitea help` will allow you review this variable and you can override it using the
35
35
`--config` option on the `gitea` binary.
36
36
@@ -39,7 +39,8 @@ Again `gitea help` will allow you review this variable and you can override it u
39
39
40
40
If the `CustomPath` folder can't be found despite checking `gitea help`, check the `GITEA_CUSTOM`
41
41
environment variable; this can be used to override the default path to something else.
42
-
`GITEA_CUSTOM` might, for example, be set by an init script.
42
+
`GITEA_CUSTOM` might, for example, be set by an init script. You can check whether the value
43
+
is set under the "Configuration" tab on the site administration page.
43
44
44
45
-[List of Environment Variables](https://docs.gitea.io/en-us/specific-variables/)
45
46
@@ -52,15 +53,15 @@ environment variable; this can be used to override the default path to something
52
53
## Serving custom public files
53
54
54
55
To make Gitea serve custom public files (like pages and images), use the folder
55
-
`custom/public/` as the webroot. Symbolic links will be followed.
56
+
`$GITEA_CUSTOM/public/` as the webroot. Symbolic links will be followed.
56
57
57
-
For example, a file `image.png` stored in `custom/public/`, can be accessed with
58
+
For example, a file `image.png` stored in `$GITEA_CUSTOM/public/`, can be accessed with
58
59
the url `http://gitea.domain.tld/image.png`.
59
60
60
61
## Changing the default logo
61
62
62
63
To build a custom logo replace `assets/logo.svg` and run `make generate-images`. This will update
63
-
these customizable logo files which you can then place in `custom/public/img` on your server:
64
+
these customizable logo files which you can then place in `$GITEA_CUSTOM/public/img` on your server:
64
65
65
66
-`public/img/logo.svg`
66
67
-`public/img/logo.png`
@@ -72,19 +73,19 @@ these customizable logo files which you can then place in `custom/public/img` on
72
73
73
74
Either generate it via above method or place the png image at the following path:
74
75
75
-
-`custom/public/img/avatar_default.png`
76
+
-`$GITEA_CUSTOM/public/img/avatar_default.png`
76
77
77
78
## Customizing Gitea pages and resources
78
79
79
80
Gitea's executable contains all the resources required to run: templates, images, style-sheets
80
81
and translations. Any of them can be overridden by placing a replacement in a matching path
81
82
inside the `custom` directory. For example, to replace the default `.gitignore` provided
82
83
for C++ repositories, we want to replace `options/gitignore/C++`. To do this, a replacement
83
-
must be placed in `custom/options/gitignore/C++` (see about the location of the `custom`
84
+
must be placed in `$GITEA_CUSTOM/options/gitignore/C++` (see about the location of the `CustomPath`
84
85
directory at the top of this document).
85
86
86
87
Every single page of Gitea can be changed. Dynamic content is generated using [go templates](https://golang.org/pkg/html/template/),
87
-
which can be modified by placing replacements below the `custom/templates` directory.
88
+
which can be modified by placing replacements below the `$GITEA_CUSTOM/templates` directory.
88
89
89
90
To obtain any embedded file (including templates), the [`gitea embedded` tool]({{< relref "doc/advanced/cmd-embedded.en-us.md" >}}) can be used. Alternatively, they can be found in the [`templates`](https://github.com/go-gitea/gitea/tree/master/templates) directory of Gitea source (Note: the example link is from the `master` branch. Make sure to use templates compatible with the release you are using).
90
91
@@ -93,16 +94,16 @@ shouldn't be touched without fully understanding these components.
93
94
94
95
### Customizing startpage / homepage
95
96
96
-
Copy [`home.tmpl`](https://github.com/go-gitea/gitea/blob/master/templates/home.tmpl) for your version of Gitea from `templates` to `custom/templates`.
97
+
Copy [`home.tmpl`](https://github.com/go-gitea/gitea/blob/master/templates/home.tmpl) for your version of Gitea from `templates` to `$GITEA_CUSTOM/templates`.
97
98
Edit as you wish.
98
99
Dont forget to restart your gitea to apply the changes.
99
100
100
101
### Adding links and tabs
101
102
102
-
If all you want is to add extra links to the top navigation bar or footer, or extra tabs to the repository view, you can put them in `extra_links.tmpl` (links added to the navbar), `extra_links_footer.tmpl` (links added to the left side of footer), and `extra_tabs.tmpl` inside your `custom/templates/custom/` directory.
103
+
If all you want is to add extra links to the top navigation bar or footer, or extra tabs to the repository view, you can put them in `extra_links.tmpl` (links added to the navbar), `extra_links_footer.tmpl` (links added to the left side of footer), and `extra_tabs.tmpl` inside your `$GITEA_CUSTOM/templates/custom/` directory.
103
104
104
105
For instance, let's say you are in Germany and must add the famously legally-required "Impressum"/about page, listing who is responsible for the site's content:
105
-
just place it under your "custom/public/" directory (for instance `custom/public/impressum.html`) and put a link to it in either `custom/templates/custom/extra_links.tmpl` or `custom/templates/custom/extra_links_footer.tmpl`.
106
+
just place it under your "$GITEA_CUSTOM/public/" directory (for instance `$GITEA_CUSTOM/public/impressum.html`) and put a link to it in either `$GITEA_CUSTOM/templates/custom/extra_links.tmpl` or `$GITEA_CUSTOM/templates/custom/extra_links_footer.tmpl`.
106
107
107
108
To match the current style, the link should have the class name "item", and you can use `{{AppSubUrl}}` to get the base URL:
@@ -116,7 +117,7 @@ The exact HTML needed to match the style of other tabs is in the file
116
117
117
118
### Other additions to the page
118
119
119
-
Apart from `extra_links.tmpl` and `extra_tabs.tmpl`, there are other useful templates you can put in your `custom/templates/custom/` directory:
120
+
Apart from `extra_links.tmpl` and `extra_tabs.tmpl`, there are other useful templates you can put in your `$GITEA_CUSTOM/templates/custom/` directory:
120
121
121
122
-`header.tmpl`, just before the end of the `<head>` tag where you can add custom CSS files for instance.
122
123
-`body_outer_pre.tmpl`, right after the start of `<body>`.
@@ -132,7 +133,7 @@ The data is encoded and sent to the PlantUML server which generates the picture.
132
133
demo server at http://www.plantuml.com/plantuml, but if you (or your users) have sensitive data you
133
134
can set up your own [PlantUML server](https://plantuml.com/server) instead. To set up PlantUML rendering,
134
135
copy javascript files from https://gitea.com/davidsvantesson/plantuml-code-highlight and put them in your
135
-
`custom/public` folder. Then add the following to `custom/footer.tmpl`:
136
+
`$GITEA_CUSTOM/public` folder. Then add the following to `custom/footer.tmpl`:
136
137
137
138
```html
138
139
{{if .RequireHighlightJS}}
@@ -201,15 +202,15 @@ You can display STL file directly in Gitea by adding:
201
202
202
203
to the file `templates/custom/footer.tmpl`
203
204
204
-
You also need to download the content of the library [Madeleine.js](https://jinjunho.github.io/Madeleine.js/) and place it under `custom/public/` folder.
205
+
You also need to download the content of the library [Madeleine.js](https://jinjunho.github.io/Madeleine.js/) and place it under `$GITEA_CUSTOM/public/` folder.
205
206
206
207
You should end-up with a folder structucture similar to:
207
208
208
209
```
209
-
custom/templates
210
+
$GITEA_CUSTOM/templates
210
211
-- custom
211
212
`-- footer.tmpl
212
-
custom/public
213
+
$GITEA_CUSTOM/public
213
214
-- Madeleine.js
214
215
|-- LICENSE
215
216
|-- README.md
@@ -255,19 +256,19 @@ Then restart gitea and open a STL file on your gitea instance.
255
256
256
257
## Customizing Gitea mails
257
258
258
-
The `custom/templates/mail` folder allows changing the body of every mail of Gitea.
259
+
The `$GITEA_CUSTOM/templates/mail` folder allows changing the body of every mail of Gitea.
Override by making a copy of the file under `custom/templates/mail` using a
263
+
Override by making a copy of the file under `$GITEA_CUSTOM/templates/mail` using a
263
264
full path structure matching source.
264
265
265
266
Any statement contained inside `{{` and `}}` are Gitea's template
266
267
syntax and shouldn't be touched without fully understanding these components.
267
268
268
269
## Adding Analytics to Gitea
269
270
270
-
Google Analytics, Matomo (previously Piwik), and other analytics services can be added to Gitea. To add the tracking code, refer to the `Other additions to the page` section of this document, and add the JavaScript to the `custom/templates/custom/header.tmpl` file.
271
+
Google Analytics, Matomo (previously Piwik), and other analytics services can be added to Gitea. To add the tracking code, refer to the `Other additions to the page` section of this document, and add the JavaScript to the `$GITEA_CUSTOM/templates/custom/header.tmpl` file.
271
272
272
273
## Customizing gitignores, labels, licenses, locales, and readmes.
273
274
@@ -277,21 +278,21 @@ Place custom files in corresponding sub-folder under `custom/options`.
277
278
278
279
### gitignores
279
280
280
-
To add custom .gitignore, add a file with existing [.gitignore rules](https://git-scm.com/docs/gitignore) in it to `custom/options/gitignore`
281
+
To add custom .gitignore, add a file with existing [.gitignore rules](https://git-scm.com/docs/gitignore) in it to `$GITEA_CUSTOM/options/gitignore`
281
282
282
283
### Labels
283
284
284
-
To add a custom label set, add a file that follows the [label format](https://github.com/go-gitea/gitea/blob/master/options/label/Default) to `custom/options/label`
285
+
To add a custom label set, add a file that follows the [label format](https://github.com/go-gitea/gitea/blob/master/options/label/Default) to `$GITEA_CUSTOM/options/label`
285
286
`#hex-color label name ; label description`
286
287
287
288
### Licenses
288
289
289
-
To add a custom license, add a file with the license text to `custom/options/license`
290
+
To add a custom license, add a file with the license text to `$GITEA_CUSTOM/options/license`
290
291
291
292
### Locales
292
293
293
-
Locales are managed via our [crowdin](https://crowdin.com/project/gitea).
294
-
You can override a locale by placing an altered locale file in `custom/options/locale`.
294
+
Locales are managed via our [crowdin](https://crowdin.com/project/gitea).
295
+
You can override a locale by placing an altered locale file in `$GITEA_CUSTOM/options/locale`.
295
296
Gitea's default locale files can be found in the [`options/locale`](https://github.com/go-gitea/gitea/tree/master/options/locale) source folder and these should be used as examples for your changes.
296
297
297
298
To add a completely new locale, as well as placing the file in the above location, you will need to add the new lang and name to the `[i18n]` section in your `app.ini`. Keep in mind that Gitea will use those settings as **overrides**, so if you want to keep the other languages as well you will need to copy/paste the default values and add your own to them.
@@ -306,9 +307,9 @@ Locales may change between versions, so keeping track of your customized locales
306
307
307
308
### Readmes
308
309
309
-
To add a custom Readme, add a markdown formatted file (without an `.md` extension) to `custom/options/readme`
310
+
To add a custom Readme, add a markdown formatted file (without an `.md` extension) to `$GITEA_CUSTOM/options/readme`
310
311
311
-
**NOTE:** readme templates support **variable expansion**.
312
+
**NOTE:** readme templates support **variable expansion**.
312
313
currently there are `{Name}` (name of repository), `{Description}`, `{CloneURL.SSH}`, `{CloneURL.HTTPS}` and `{OwnerName}`
313
314
314
315
### Reactions
@@ -324,7 +325,7 @@ A full list of supported emoji's is at [emoji list](https://gitea.com/gitea/gite
324
325
325
326
## Customizing the look of Gitea
326
327
327
-
As of version 1.6.0 Gitea has built-in themes. The two built-in themes are, the default theme `gitea`, and a dark theme `arc-green`. To change the look of your Gitea install change the value of `DEFAULT_THEME` in the [ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui) section of `app.ini` to another one of the available options.
328
+
As of version 1.6.0 Gitea has built-in themes. The two built-in themes are, the default theme `gitea`, and a dark theme `arc-green`. To change the look of your Gitea install change the value of `DEFAULT_THEME` in the [ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui) section of `app.ini` to another one of the available options.
328
329
As of version 1.8.0 Gitea also has per-user themes. The list of themes a user can choose from can be configured with the `THEMES` value in the [ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui) section of `app.ini` (defaults to `gitea` and `arc-green`, light and dark respectively)
0 commit comments