Use g.If in HTML5 helper (#65) Inlining looks much nicer.
1 file changed, 2 insertions(+), 9 deletions(-)
changed files
M components/documents.go → components/documents.go
@@ -18,20 +18,13 @@ } // 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)),