Hi there,
On my list.html partial, I would like to display my category links with different colors.
For instance, on the blog post summary, I want to “General” category to be in blue background, and the “Tips” category to in purple background.
I have tested this method but returns a Hugo server error.
Not sure what’s wrong with this code, looks clean to me. Is it missing something?
{{ range $tag := .Params.tags }}
{{ if eq tag "hugo" }}
<span class="tag" style="background-color: {{ .Site.Params.hugo }};">{{ $tag }}
{{ else if eq tag "gatsby" }}
<span class="tag" style="background-color: {{ .Site.Params.gatsby }};">{{ $tag }}
{{ else }} {{ $tag }}
{{ end }}
Thanks jmooring,
Sorry about the code layout, I thought it worked in the edit box, but when I published it, it was not. Thanks for the link, I will remember for next time.
I can’t see the difference, yet, but I’ll give it an other try.
About the error, it was such a long error and didn’t have any number. It was in redish background and specified the lines where the error was. It was highlighting the {{ end }} but every time I was deleting the line, the next previous one would be the error.
Hope this makes sense, but I’ll be working on it again.
Thanks