spreadsheet-cms
a hack to generate static content from a google spreadsheet
expectations for data
- first row defines fields
- must contain unique id column
- text delimiter is
"
- field separator
,
- localize fields, by appending
-<lang>
example/data.csv
lists in data
If you want to define a list in your data, the list item delimiter is an new line and use the List function.
Usage
spreadsheet-cms -csv https://server.com/data.csv -languages de,en -out path/to/out-dir -asset-dir path/to/assets
Templating
Template funcs
Check for assets
{{ $asset := print .id ".jpg" }}
{{ if HasAsset $asset }}
<img src="./path/to/assets/{{$asset}}">
{{ end }}
Check for empty values
{{ if Empty .name }}
<h1>No name given</h1>
{{ else }}
<h1>{{.name}}</h1>
{{ end }}
Lists
<ul>
{{ range $listItem := List .features }}
<li>{{$listItem}}</li>
{{ end }}
</ul>