fix: use explicit if/else template dispatch instead of dynamic name
html/template requires template names to be string literals, not field
accesses. Use {{if eq .Template "videos"}} to branch and call the
appropriate template by literal name.
This commit is contained in:
parent
a8104da887
commit
ccb985d40c
1 changed files with 5 additions and 1 deletions
|
|
@ -52,7 +52,11 @@
|
|||
<div id="urls" role="main">
|
||||
{{if .Results}}
|
||||
{{range .Results}}
|
||||
{{template .TemplateName .}}
|
||||
{{if eq .Template "videos"}}
|
||||
{{template "video_item" .}}
|
||||
{{else}}
|
||||
{{template "result_item" .}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{else if not .Answers}}
|
||||
<div class="no_results">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue