I have this bad ass short code
<table border="1">
{{ range $i, $r := getSql "SELECT name,sku,url_path,price FROM `catalog_product_flat_1` where type_id=\"configurable\" and price > 350" }}
{{ if eq $i 0 }}
<thead>
<tr>
<th>Name</th>
<th>Sku</th>
<th>Url</th>
</tr>
</thead>
{{else}}
<tbody>
<tr>
<td>{{ index $r "name" }}</td>
<td>{{ index $r "sku" }}</td>
<td><a href="/{{ index $r "url_path" }}">{{ index $r "price" }}</a></td>
</tr>
</tbody>
{{end}}
{{ end }}
</table>
The new feature getSql is available here. For self-compilers: check for build tags for using different drivers.
My problem is that the SQL query itself gets too long. How can I do a line break? Everything I’ve tried makes Hugo panic
I would like to have something:
{{ range $i, $r := getSql "SELECT name,sku,url_path,price
FROM `catalog_product_flat_1`
WHERE type_id=\"configurable\" and price > 350" }}
Any ideas?