{{ if .Params.FeaturedImagePreview }}
{{ $img := .Params.FeaturedImagePreview }}
<img class="mw-100 w-100 h-100 rounded-start" src="{{ $img }}" alt="00....">
{{ else }}
<img class="mw-100 w-100 h-100 rounded-start" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" alt="{{ .Title }}">
{{ end }}
How can we simply output $img as a string output without additional operations?
The functions I have tried are as follows, but none of them work. It came out for a while, and then it disappeared again. I don’t know how to operate it.
base64Encode
safeHTMLAttr
string
safeCSS
print
I have also read the following posts and examples, and I feel that it is not what I want, that needs to split the base64 code, and it is also related to the format. . .
The current result is this, not the gif transparent image, which proves that $img exists, but something is wrong.
<img class="mw-100 w-100 h-100 rounded-start" src="#ZgotmplZ" alt="00....">