Spreadsheet2Site includes several pre-defined templates and offers the option to build custom templates to your liking.
Template Folder
Templates are stored in a template folder and the folder is set as a parameter:
spreadsheet2site-osx build -sheet <sheetId> templates/ -output <output file or dir>
In the example it’s the relative folder templates/. You can use any relative or absolute path.
Selecting the Template in the Google Sheet
The template filename without the file extension is the name of the template to put in the Google Sheet under siteinfo - template.
Default Templates
- default: clean listing template. Uses Bulma CSS
- default_cards: clean card layout. Uses Bulma CSS
- shop: minimalistic shop frontend using Tailwind CSS
Customizing Templates
Templating System
Spreadsheet2site uses html/template from GO. The template syntax is straightforward.
Access Sheet Values aka Objects
- Items: list of all items (items tab in sheet; each row becomes an item object
- Name: name of the site (siteinfo tab - name field)
- Description: name of the site (siteinfo tab - description field)
- Meta.*: access all fields by name of the siteinfo tab. (First letter is always capatilzed, e.g. slogan = Slogan)
- NavItems: list of navitems (navigation tab), each with a URL (column B) and Name (column A)
Item Object
Row #2 in the spreadsheet defines the column names. Column names shall only conaint latin alphabet a to z, lower and uppercase. The first eltter of a column name is always capatilized.
name -> Name shortDecription -> ShortDescription
Shop Template
The shop template uses some pre-defined columns. Read the How to Build a Simple Shop for Digital Goods With Google Sheets guide for further use.