Skip to content

Commit 97fb7f0

Browse files
document custom home view (#21066)
Co-authored-by: Travis Ralston <travisr@matrix.org>
1 parent 41f0554 commit 97fb7f0

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed

docs/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ Starting with `branding`, the following subproperties are available:
193193
`welcome.html` that ships with Element will be used instead.
194194
2. `home_url`: A URL to an HTML page to show within the app as the "home" page. When the app doesn't have a room/screen to
195195
show the user, it will use the home page instead. The home page is additionally accessible from the user menu. By default,
196-
no home page is set and therefore a hardcoded landing screen is used.
196+
no home page is set and therefore a hardcoded landing screen is used. More documentation and examples are [here](./custom-home.md).
197197
3. `login_for_welcome`: When `true` (default `false`), the app will use the login form as a welcome page instead of the welcome
198198
page itself. This disables use of `welcome_url` and all welcome page functionality.
199199

docs/custom-home.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Custom Home Page
2+
3+
The home page is shown whenever the user is logged in, but no room is selected.
4+
A custom `home.html` replacing the default home page can be configured either in `.well-known/matrix/client` or `config.json`.
5+
Such a custom home page can be used to communicate helpful information and important rules to the users.
6+
7+
## Configuration
8+
9+
To provide a custom home page for all element-web/desktop users of a homeserver, include the following in `.well-known/matrix/client`:
10+
11+
```
12+
{
13+
"io.element.embedded_pages": {
14+
"home_url": "https://example.org/home.html"
15+
}
16+
}
17+
```
18+
19+
The home page can be overridden in `config.json` to provide all users of an element-web installation with the same experience:
20+
21+
```
22+
{
23+
"embeddedPages": {
24+
"homeUrl": "https://example.org/home.html"
25+
}
26+
}
27+
```
28+
29+
30+
## `home.html` Example
31+
32+
The following is a simple example for a custom `home.html`:
33+
34+
```
35+
<style type="text/css">
36+
.tos {
37+
width: auto;
38+
color: black;
39+
background : #ffcccb;
40+
font-weight: bold;
41+
}
42+
</style>
43+
44+
<h1>The example.org Matrix Server</h1>
45+
46+
<div class="tos">
47+
<p>Behave appropriately.</p>
48+
</div>
49+
50+
<h2>Start Chatting</h2>
51+
<ul>
52+
<li><a href="#/dm">Send a Direct Message</a></li>
53+
<li><a href="#/directory">Explore Public Rooms</a></li>
54+
<li><a href="#/new">Create a Group Chat</a></li>
55+
</ul>
56+
```
57+
58+
When choosing colors, be aware that the home page may be displayed in either light or dark mode.
59+
60+
It may be needed to set CORS headers for the `home.html` to enable element-desktop to fetch it, with e.g., the following nginx config:
61+
62+
```
63+
add_header Access-Control-Allow-Origin *;
64+
```
65+

0 commit comments

Comments
 (0)