I noticed that depending on whether a summary was produced automatically or via a <!–more—> break, it can be either plain text or HTML. This means if I embed it as {{ .Summary }} it may not appear inside a paragraph tag, and therefore miss some CSS styling. My idea was to make a case distinction like this:
{{ if hasPrefix .Summary "<" }}
{{ .Summary }}
{{ else }}
<p>{{ .Summary }}</p>
{{ end }}
However, I get a template error at the first occurance of .Summary in the line with the hasPrefix function.
I looked at the source code and found that the first parameter of the hasPrefix function does not have a type declaration. Can this be the cause for this problem? Or am I doing something wrong?
Do you have an explanation why this casting to string is needed with hasPrefix, but not with substr? Can hasPrefix be changed so that it works like substr?