I’ve had some fantastic support from these forums the past couple of months but I want to learn more about golang and specifically golang templates so that I don’t have to keep asking numpty newbie questions.
I think Go is a great language to learn and work in, but…
I don’t think you need to study Go for this. If you want to take up learning Go as a hobby and can use it for other tasks as well, go for it.
But templating is just a small subset in Go, and it feels inefficient to me to learn the Go programming language just for that. Furthermore, most Go programming courses that I came across don’t deal with templating because it’s a small subset of possible things you can do with Go.
To put it into perspective, Donovan & Kernighan’s Go programming book (The Go Programming Language.) spends 5 pages talking about the text/template and html/template packages (which do the templating you talk about here). The other 360 pages are about other Go features.
If you just want to know more about how templating goes with Go, reading blog articles like these will get you there:
Thanks so much for the comprehensive answer, those templating links will save me a lot of time . I would like to learn more about Go but at the moment, I have to concentrate on designing and building websites for clients, which is one of the reasons I’m getting on so well with Hugo.
I like to think I have a pretty good grasp with Hugo templating, and I would highly recommend the route I took:
Udacity Intro to Programming Course - This will teach you about programming logic etc. It uses Python, but the concepts help with any language.
TeamTreehouse do a 2 hour course that looks at Go Syntax. You need to know a programming language already as it doesn’t teach concepts, but it helped me understand quite a bit and apply my Python knowledge to Go Templates.
Then just start building stuff, and learn as you go. Pick apart examples on the forum \ hugo docs. I remember a lot of trial and error type coding when I first started, but slowly and surely, everything started to click.
Anyway, that is the route I took, and it worked well. Probably not the most efficient way though, as I didn’t know about Hugo until after I learnt python.
Actually when I first started building a website, I took someones theme and tried to adapt it to my purposes. I could see the layout and how to approach templating. After a few days of adapting the theme I then decided to build my own website from scratch, but taking code snippets from the theme \ hugo docs. Looking at existing theme when starting really does help, and how I first started building a site with Hugo.