summaryrefslogtreecommitdiff
path: root/internal/api/util
diff options
context:
space:
mode:
Diffstat (limited to 'internal/api/util')
-rw-r--r--internal/api/util/template.go21
1 files changed, 18 insertions, 3 deletions
diff --git a/internal/api/util/template.go b/internal/api/util/template.go
index ec04a4d97..38e79484f 100644
--- a/internal/api/util/template.go
+++ b/internal/api/util/template.go
@@ -48,10 +48,10 @@ type WebPage struct {
// Can be nil.
Stylesheets []string
- // Paths to JS files to add to
- // the page as "script" entries.
+ // JS files to add to the
+ // page as "script" entries.
// Can be nil.
- Javascript []string
+ Javascript []JavascriptEntry
// Extra parameters to pass to
// the template for rendering,
@@ -60,6 +60,21 @@ type WebPage struct {
Extra map[string]any
}
+type JavascriptEntry struct {
+ // Insert <script> tag at the end
+ // of <body> rather than in <head>.
+ Bottom bool
+
+ // Path to the js file.
+ Src string
+
+ // Use async="" attribute.
+ Async bool
+
+ // Use defer="" attribute.
+ Defer bool
+}
+
// TemplateWebPage renders the given HTML template and
// page params within the standard GtS "page" template.
//