diff options
author | Markus Wüstenberg | 2021-04-28 10:42:49 +0200 |
---|---|---|
committer | GitHub | 2021-04-28 10:42:49 +0200 |
commit | 5d2f0f1b87aff69edf5b3a993afbb1ae2db946d0 (patch) | |
tree | 43eeb847b5d1ddfa4fb483b67adeffe4c612c49d /components | |
parent | c899a050c06733965dae8ea686daab36e187ba45 (diff) | |
download | gomponents-5d2f0f1b87aff69edf5b3a993afbb1ae2db946d0.tar.lz gomponents-5d2f0f1b87aff69edf5b3a993afbb1ae2db946d0.tar.zst gomponents-5d2f0f1b87aff69edf5b3a993afbb1ae2db946d0.zip |
Use g.If in HTML5 helper (#65)
Inlining looks much nicer.
Diffstat (limited to 'components')
-rw-r--r-- | components/documents.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/components/documents.go b/components/documents.go index 47373cc..b9ab085 100644 --- a/components/documents.go +++ b/components/documents.go @@ -18,20 +18,13 @@ type HTML5Props struct { // HTML5 document template. func HTML5(p HTML5Props) g.Node { - var lang, description g.Node - if p.Language != "" { - lang = Lang(p.Language) - } - if p.Description != "" { - description = Meta(Name("description"), Content(p.Description)) - } return Doctype( - HTML(lang, + HTML(g.If(p.Language != "", Lang(p.Language)), Head( Meta(Charset("utf-8")), Meta(Name("viewport"), Content("width=device-width, initial-scale=1")), TitleEl(p.Title), - description, + g.If(p.Description != "", Meta(Name("description"), Content(p.Description))), g.Group(p.Head), ), Body(g.Group(p.Body)), |