Template Snippets¶
Since version v6.2, dtable-web allows injecting a custom Django template snippet into certain HTML templates. This template snippet is included into the following HTML templates:
| Template | Purpose |
|---|---|
react_dtable.html | Used when rendering the SeaTable dashboard. |
dtable_file_view_react.html | Used when a base is opened. |
base_for_external_app.html | Used when a universal app is opened. |
Mounting the HTML file¶
In order to inject a snippet, an additional volume mount must be added to the seatable-server service. You should use an additional .yml file to accomplish this.
services:
seatable-server:
volumes:
- ./custom_body_snippet.html:/shared/seatable/seahub-data/custom/templates/custom_body_snippet.html
The filename on the host may differ, but you must mount the file to this exact location. You can use Django's full templating capabilities inside the HTML file.
Do not forget to restart the container once you're done:
cd /opt/seatable-compose
docker compose up -d
Use Cases¶
Here are some use cases for this feature:
- Web analytics
- Error tracking
- Customizing the UI via JavaScript