<ul class="list-unstyled">
{{ range (where .Site.RegularPages "Section" "news") }}
<li class="ink--text">
<a href="#{{ cond (in (.Title|anchorize) "%") (.Title | base64Encode) (.Title) | anchorize }}">
{{ with .Params.cover }}<img src="{{ . }}" alt="">{{ . }}{{ end }}
<span>{{ .Title }}</span>
<span>{{ .Description }}</span>
</a>
</li>
{{ end }}
</ul>
I would like to transform the line {{ with .Params.cover }}<img src="{{ . }}" alt="">{{ . }}{{ end }} by a new one in order to use svg instead of img and src, having in mind that the frontmatter Params cover is : “images/news.svg”
How to use directly svg instead as img src, meaning the html result should be <a href="#news"><svg>.....</svg></a> instead of <a href="#news"><img src="images/news.svg" alt=""></a>
Thanks for the swift answer.
I ran through the recommended docs but my skills (if any) are too limited to transform the above lines in a working bit of code.
Any suggested examples in order to better understand the rational when using the two proposed functions ?
Your proposed code isn’t working as my svg file is located in the page directory (as a page bundle).
I tested a relative path (.RelPermalink) without success.
I still continue to find a way to solve the issue.
Thanks, it works ! I still have some difficulties to make a clear difference when using page .Resource (page bundle vs leaf bundle vs regular page) {{ with .Params.cover }}{{ . | safeHTML }}{{ end }}