[SOLVED] Where can I read about how to use html/template expressions?

Hi guys,
is there something similar to this: http://jinja.pocoo.org/docs/dev/templates/#synopsis
for html/template?
I was reading the package documentation, but I didn’t get how to use html/template to make an html webpage template. Can you also make expressions like loops and stuff?
Please help me and give me some resources to read.

Thanks in advance!

Hey @luk, you should read the package documentation for not only html/template but also text/template. https://golang.org/pkg/text/template/.

A lot of what you can actually do is talked about there and since html/template is built upon that, anything you can do there you can use for html/template too.

But short answer, you very much can make loops and lots of other things too.

1 Like

Thanks, that’s what I needed.

Here are also a small collection of examples for html/template and text/template.

html/template, text/template.

They are both missing a lot of what you can actually use since there are lots of things that I didn’t include, but it might help you understand some simple ideas with both of them :slight_smile:

If there’s any examples you want me to add to that repository for any of the package’s, not just those ones, feel free to let me know and I’ll be happy to write something up!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.