blob: 6c5eac32f4bc9e6e9009bee3cf4a359c17b7928f [file] [log] [blame] [view]
David Pursehouse240fbff2016-08-25 09:58:15 +09001# Configuration
2
3The `gitiles.config` file supporting the site contains several configuration
4options.
5
6[TOC]
7
David Pursehousef7018102016-08-25 10:10:23 +09008## Core configuration
9
Antoine Musso0b4abb42022-06-30 22:12:26 +020010### Site Title
11
12The title of the site. Default: `Gitiles`.
13
14```
15[gitiles]
16 siteTitle = Acme Inc. Git Browser
17```
18
Antoine Musso68f511a2022-06-30 22:13:36 +020019### URLs
20
21`canonicalHostName`.
22Default: `null`, determine the hostname from the local host.
23
24`baseGitUrl` the base URL for git repositories.
25
Ilmari Lauhakangasace68b42024-11-29 12:07:17 +020026`gerritUrl`, URL prefix that when set is used to create:
27* Links from the `Change-Id` headers in commit messages to the corresponding
28 Gerrit change.
29* An edit link in file views that opens a new change in Gerrit in online edit
30 mode for that file. The link will only appear when you are browsing the file
31 at a branch, so the commitish must start with `refs/heads/`.
32
33> If you are using the Gerrit Gitiles plugin, this is set based on Gerrit's configuration.
34> Default: `null`, do not link `Change-Id` or show edit links.
Antoine Musso68f511a2022-06-30 22:13:36 +020035
36```
37[gitiles]
38 canonicalHostName = gitiles.example.org
39 gerritUrl = https://gerrit.example.org/r/
40 baseGitUrl = git://git.example.org/
41```
42
Antoine Musso33d4c132022-06-30 22:14:13 +020043### Repositories export
44
45Set `exportAll` to instruct jGit to export all repositories, ignoring the check
46for existence of `git-daemon-export-ok` file at the root of the repository.
47
48Default: `false`, repositories need to be explicitly marked for export.
49
50```
51[gitiles]
52exportAll = true
53```
54
Antoine Mussoda9134f2022-06-30 22:14:33 +020055### Custom templating
56
57The web views are defined via Soy templates, you inject your own version which
58will be passed to the renderer. See `.soy` files in the source code for
59available templates
60
61```
62[gitiles]
63customTemplates = path/to/somefile.soy
64customTemplates = path/to/another.soy
65```
66
Daniele Sassoliacf2a192023-03-06 20:32:56 +000067### Custom styling
68
69It's possible to inject custom styles within the template. To do this add
70the following to `gitiles.config`:
71```
72[gitiles]
73 customTemplates = path/to/afile.soy
74[template]
75 customVariant=aVariant
76```
77Where `customVariant` is the variable defined in the default
78templates themselves. Then you can define `afile.soy` as follows:
79```
80{namespace gitiles}
81{deltemplate gitiles.customHeadTagPart variant="'aVariant'"}
82
83<link rel="stylesheet" type="text/css" href="/static/file.css" />
84
85{/deltemplate}
86```
87It is also possible to define a `<style>` tag there if desired.
88
Dave Borowitzed97b7f2022-06-30 20:28:03 +020089### Fixed time zone
90
91By default dates are formatted including the local user time zone as that
92matches git tools. Some users/administrators may prefer normalizing to a
93particular timezone so times are directly comparable without doing timezone
94arithmetic.
95
96Setting `fixedTimeZone` to a valid Java TimeZone ID causes all dates in the UI
97to be implicitly converted to this timezone, and the now-redundant timezone
98offset to be dropped from the output.
99
100```
101[gitiles]
102 fixedTimeZone = UTC
103```
104
David Pursehousef7018102016-08-25 10:10:23 +0900105### Cross-Origin Resource Sharing (CORS)
106
107Gitiles sets the `Access-Control-Allow-Origin` header to the
108HTTP origin of the client if the client's domain matches a regular
109expression defined in `allowOriginRegex`.
110
111```
112[gitiles]
113 allowOriginRegex = http://localhost
114```
115
116By default `allowOriginRegex` is unset, denying all cross-origin requests.
117
Antoine Musso07e21422022-06-30 22:14:59 +0200118### Gitweb redirector
119
120Redirect requests to old gitweb URLs after having migrated to Gitiles. Matching
121URLs will be redirected permanently to their Gitiles equivalent.
122Default: `true`.
123
124```
125[gitiles]
126redirectGitweb = false
127```
128
David Pursehouse240fbff2016-08-25 09:58:15 +0900129## Markdown
130
131### Disabling markdown
132
133Markdown can be completely disabled by setting render to false.
134
135```
136[markdown]
137 render = false
138```
139
140### Markdown size
141
142Markdown files are limited by default to 5 MiB of input text
143per file. This limit is configurable, but should not be raised
144beyond available memory.
145
146```
147[markdown]
148 inputLimit = 5M
149```
150
151### Image size
152
153Referenced [images are inlined](#Images) as base64 encoded URIs.
154The image limit places an upper bound on the byte size of input.
155
156```
157[markdown]
158 imageLimit = 256K
159```
160
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700161### Extensions
162
163The following extensions can be enabled/disabled in the markdown
164section:
165
166* `githubFlavor`: enable extensions that mirror GitHub Flavor
167 Markdown behavior. Default is true.
168
169* `autolink`: automatically convert plain URLs and email
David Pursehouse0c122622017-07-02 13:33:58 +0900170 addresses into links. Default follows `githubFlavor`.
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700171
172* `blocknote`: Gitiles style note/promo/aside blocks to raise
173 awareness to important content. Default false.
174
175* `ghthematicbreak`: accept `--` for `<hr>`, like GitHub Flavor
176 Markdown. Default follows `githubFlavor`.
177
178* `multicolumn`: Gitiles extension to layout content in a 12 cell
179 grid, delinated by section headers. Default false.
180
181* `namedanchor`: Gitiles extension to extract named anchors using
182 `#{id}` syntax. Default false.
183
184* `safehtml`: Gitiles extension to accept very limited HTML; for
185 security reasons all other HTML is dropped regardless of this
186 setting. Default follows `githubFlavor`.
187
188* `smartquote`: Gitiles extension to convert single and double quote
189 ASCII characters to Unicode smart quotes when in prose. Default
190 false.
191
192* `strikethrough`: strikethrough text with GitHub Flavor Markdown
193 style `~~`. Default follows `githubFlavor`.
194
195* `tables`: format tables with GitHub Flavor Markdown. Default
196 follows `githubFlavor`.
197
198* `toc`: Gitiles extension to replace `[TOC]` in a paragraph by itself
199 with a server-side generated table of contents extracted from section
200 headers. Default true.
201
David Pursehousebbcc5132016-08-26 13:26:13 +0900202### IFrames
203
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700204IFrame support requires `markdown.safehtml` to be true.
205
David Pursehousebbcc5132016-08-26 13:26:13 +0900206IFrame source URLs can be whitelisted by providing a list of allowed
207URLs. URLs ending with a `/` are treated as prefixes, allowing any source
208URL beginning with that prefix.
209
210```
211[markdown]
212 allowiframe = https://google.com/
213```
214
215URLs not ending with a `/` are treated as exact matches, and only those
216source URLs will be allowed.
217
218
219```
220[markdown]
221 allowiframe = https://example.com
222 allowiframe = https://example.org
223```
224
225If the list has a single entry with the value `true`, all source URLs
226will be allowed.
227
228
229```
230[markdown]
231 allowiframe = true
232```
233
David Pursehouse240fbff2016-08-25 09:58:15 +0900234## Google Analytics
235
236[Google Analytics](https://www.google.com/analytics/) can be
237enabled on every rendered markdown page by adding the Property ID
238to the configuration file:
239
240```
241[google]
242 analyticsId = UA-XXXX-Y
243```