spreadsheet-cms

command module
v0.0.0-...-0e8c2e5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 11 Imported by: 0

README

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>

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL