Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/janhalfar/spreadsheet-cms
a hack to generate static content from a google spreadsheet
https://github.com/janhalfar/spreadsheet-cms
Last synced: about 1 month ago
JSON representation
a hack to generate static content from a google spreadsheet
- Host: GitHub
- URL: https://github.com/janhalfar/spreadsheet-cms
- Owner: janhalfar
- License: mit
- Created: 2020-09-22T08:09:40.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-22T12:55:22.000Z (over 4 years ago)
- Last Synced: 2024-03-17T00:45:00.779Z (11 months ago)
- Language: Go
- Size: 6.84 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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 `-`[example/data.csv](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
```bash
spreadsheet-cms -csv https://server.com/data.csv -languages de,en -out path/to/out-dir -asset-dir path/to/assets
```## Templating
- uses go std lib templates [https://golang.org/pkg/html/template/](https://golang.org/pkg/html/template/)
- the hugo.io docs have a solid intro [https://gohugo.io/templates/introduction/](https://gohugo.io/templates/introduction/)### Template funcs
#### Check for assets
```html
{{ $asset := print .id ".jpg" }}
{{ if HasAsset $asset }}
![]()
{{ end }}
```#### Check for empty values
```html
{{ if Empty .name }}
No name given
{{ else }}
{{.name}}
{{ end }}
```#### Lists
```html
- {{$listItem}}
{{ range $listItem := List .features }}
{{ end }}
```