You could create a table data file at data/table.toml
:
[table]
[[row]]
data = ["Animal", "Sound"]
[[row]]
data = ["Cat", "Meow"]
[[row]]
data = ["Dog", "Woof"]
Then in your template:
{{ $.Scratch.Set "count" 0 }}
<table>
{{ range $table := .Site.Data.table }}
{{ range $row := $table }}
<tr>
{{ range $datas := $row }}
{{ range $data := $datas }}
{{ if eq 0 ($.Scratch.Get "count") }}
<th>
{{ . }}
</th>
{{ else }}
<td>
{{ . }}
</td>
{{ end }}
{{ end }}
{{ end }}
</tr>
{{ $.Scratch.Add "count" 1 }}
{{ end }}
{{ end }}
</table>
Which would output this:
Animal | Sound |
---|---|
Cat | Meow |
Dog | Woof |