about summary refs log tree commit diff stats
path: root/components
diff options
context:
space:
mode:
authorMarkus Wüstenberg2021-05-05 09:03:16 +0200
committerGitHub2021-05-05 09:03:16 +0200
commit3b7dceab897709fe8243c605adea90ee771c49ff (patch)
tree78e5fd6151111dca6f60e9e365c79b897e0c4bca /components
parent5d2f0f1b87aff69edf5b3a993afbb1ae2db946d0 (diff)
downloadgomponents-3b7dceab897709fe8243c605adea90ee771c49ff.tar.lz
gomponents-3b7dceab897709fe8243c605adea90ee771c49ff.tar.zst
gomponents-3b7dceab897709fe8243c605adea90ee771c49ff.zip
Streamline HTML element API (#66)
There were a lot of elements previously, like `Em`, `H1`, and a lot more, that took a string as the first argument previously. This was weird when you wanted to mix elements to output html like `<strong><em>…</em></strong>` or `<h1>Something <em>something</em> something</h1>`. gomponents is not an HTML validator, so I want people to be able to use elements however they please, also without text content.

This also means that all elements now have the same API.
Diffstat (limited to 'components')
-rw-r--r--components/documents.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/components/documents.go b/components/documents.go
index b9ab085..c7d8f8d 100644
--- a/components/documents.go
+++ b/components/documents.go
@@ -23,7 +23,7 @@ func HTML5(p HTML5Props) g.Node {
 			Head(
 				Meta(Charset("utf-8")),
 				Meta(Name("viewport"), Content("width=device-width, initial-scale=1")),
-				TitleEl(p.Title),
+				TitleEl(g.Text(p.Title)),
 				g.If(p.Description != "", Meta(Name("description"), Content(p.Description))),
 				g.Group(p.Head),
 			),