lundi 19 septembre 2016

iterate Map / Dictionary in golang mustache template

I'm a beginner at Go and am teaching myself some web dev. I'm trying to loop over a map in a template file and cant find any documentation on how to do it. Here is my struct i pass in:

type indexPageStruct struct {
BlogPosts   []post
ArchiveList map[string]int
}

I can loop over BlogPosts just fine using:


                <article>
                    <h2><a href="/"></a></h2>
...

But i cant seem to figure out how to do something like :


                <article>
                    <h2><a href="/"> - </a></h2>
....




Aucun commentaire:

Enregistrer un commentaire