Hugo version 0.27
Trying to parse a local csv file and I’m unable to do so.
My csv is located at /static/data/leaders.csv
Code is:
{{ $url := "static/data/leaders.csv" }}
{{ $sep := "," }}
{{ range $i, $r := getCSV $sep $url }}
<tr>
<td>{{ index $r 0 }}</td>
<td>{{ index $r 1 }}</td>
<td>{{ index $r 2 }}</td>
</tr>
{{ end }}
No errors being thrown, what am I missing?
EDIT
Originally I had the getCSV
function directly in a single page, for a lark I put it inside a partial and now it works!
So my question now is does it always need to go inside a partial, or is there any way to render it directly in a layout html page?