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