I’m trying to create several pages from a json file in Site.Data, and then create a taxonomy node to list all the keywords. In my thought there should also be a list in each keyword’s node that links to the pages with the same keyword. I created a .gotmpl file under the root of content folder like this:
{{ $data := .Site.Data.recipes.drinks | jsonify | transform.Unmarshal }}
{{ range $data }}
{{ $content := dict
"mediaType" "text/markdown"
"value" (print "Category: " .strCategory)
}}
{{ $keywords := slice .strCategory }}
{{ $page := dict
"content" $content
"kind" "page"
"path" (print "recipes/" .idDrink)
"keywords" $keywords
"title" .strDrink
}}
{{ $.AddPage $page }}
{{ $term := dict
"kind" "term"
"path" (print "keywords/" .strCategory)
"content" $content
"title" .strCategory
}}
{{ $.AddPage $term }}
{{ end }}
I noticed even if I can create all the keyword nodes, I can’t get the lists of pages for the nodes. What is the correct way?