Data Structure
Core Data
Every page is templated with the following data structure
You can view your theme data in your data snapshot file at .sitechef/data.json
{
uid integer the internal id of the site
environment string development if running locally or production
assetsRoot string the absolute url of the assets folder of your theme (this will be the dist/ folder)
imageRoot string the absolute path of the user-uploads CDN
assetsRoot string The absolute root of the dist folder once published
siteRoot string The absolute root of the theme
storageRoot string the absolute root of any user-uploaded documents
logo string html for the logo
logoUrl string the absolute url of the standard resolution logo
pageType string The type of page being rendered
root - this is the landing page
subcategory - any child of the frontpage
media - a static page describing a user-uploaded image/video
post - a static blog post *
offer - permalink page for a special offer
preferences struct list of user-set variables
socialMedia array User social media links
specialOffers array Special Offers:
[
specialOffer struct Array of any valid special offers
]
meta struct user-specific configuration automatically generated
menu array the main site navigation hiearchy with nested children
menuChildren array If the current page has children, they are listed here - useful for submenus
content struct data about the current page
voucher struct data about the current voucher (only available through voucher.html and voucherEmail.html template entrypoints)
emailSettings struct data about the current voucher (only available through voucherEmail.html template entrypoints)*
}
Preferences Struct
Preferences are user-generated options
{
currentTemplate string active template name
siteLogo string relative url of logo to image root
siteLogo_2x string relative url of logo for retina to image root
comingSoon bool whether or not the site is coming soon
restaurantName string
restaurantDescription string
restaurantGeo object Latitude and longitude of restaurant for maps and geo-tagging
{
lat float
lng float
}
address1 string
address2 string
postcode string
phone string
email string official venue email (not the users's)
openingHours string
googleAccount string google analytics account code
twitter string twitter handle
instagram string instagram url
facebook string facebook page url
}
SocialMedia Array
Links to user's social media services
[
These are not always available and
vary according to whether the user has entered them
facebook string
twitter string
instagram string
pinterest string
email string
]
Meta Struct
Server-generated user settings
{
favIcon string absolute path of the favicon
logo string rendered html of the logo
isMobile string is this being viewed on a mobile device - only works in production *
imageRoot string Absolute root of the CDN for user content
siteRoot string absolute path of site root
customJS string frontend javascript variables
templatePreferences struct User options selected by the current user
{
colours struct user colour options by id
fonts struct user font options by id
variables struct user colour options by id
}
}*
Menu Array
Nested site hierarchy for rendering the navigation
[
Menu struct
]
Menu Struct
A Cut-down version of the Content Struct
{
id int id of page
importance int higher number pages appear first order
name string name /title of page
url string slug or relative url of page
path string absolute url of page
published bool whether or not the page has been published
isExternal bool is this an external link
showOnMobile bool display this page when viewed on mobile
showInFooter bool display a link to this page in the page footer
level int 0 is frontpage, 1 subcategory, 2 child of subcategory
parent object information about the parent item of this menu
{
id integer
}
children array
[
Menu struct
]
}
Content Struct
The core content for the current page
Below descriptions are for pages of type subcategory|root
- other page types eg post|offer relate to their relevant struct
{
id int the unique id of this page
name string Page title - what appears in the navigation
description string the page summary
body string the body with widgets rendered - use in preference to rawBody *
rawBody string body before widgets have been rendered
parent struct
{
id int Id of the parent page
}
items array
[
Item struct
]
uri string the absolute path form site root eg /gallery
url string slug for this page eg. 'gallery'
level int what level in site hierarchy:
0 - Front page
1 - Child of Front page *
2 - Child of child of front page
type string the current page format - use the format integer in preference
as this is internationalized
format int the current page format
0 - Gallery
1 - Blog
2 - Food Menu
3 - Stream - ie raw data from instragram
4 - Static Page *
5 - External Link
6 - Contact Page
showOnMobile bool display this page when viewed on mobile
showInFooter bool display a link to this page in the page footer
linkImage string absolute path of the image to use when external sites show a preview of this page
featuredImage struct featured image for this section (Image)
htmlTitle string text for the brower tab title
metaDescription string text for the meta description for the page
lastUpdated string date formatted YYYY-MM-DD hh:ii:ss
customSettings struct [OPTIONAL] this is contingent on page type
{
galleryType string Type of gallery: carousel or mosaic
location object Location override
}
blogPosts array Only present when format is 1
[
Blog Post struct
]
blogPageTotal int Only present when format is 1 total number of blog pages
prevBlogPage string|false Only present when format is 1 url to previous blog page
nextBlogPage string|false Only present when format is 1 url to next blog page
foodMenu struct Only present when format is 2
{
id integer
menus array
[
meal A meal e.g. Breakfast
]
}
customFields struct key-value hash of custom data for this page
{
fieldKey string: struct key-value hash describing custom field types
{
fieldKey string:
Item Struct
Data for an image or video
{
id int id of the item
title string Image/Video Title
description string Image/Video Description (can contain HTML)
type string the type of item
image - a jpeg
html5 - html5 video hosted by SiteChef
youtube - a youtube video to embed
vimeo - a vimeo video to embed
tags string User-tagged data
slug string url to static version of this item
image struct Image Data
video struct Youtube/Vimeo Metadata
videoData struct [OPTIONAL] HTML5 Video Data
}
Image Struct
Data for accessing different versions of images
{
large struct large image (max 1200px)
{
src string Absolute path of large image
}
mobile struct mobile image (max 600px)
{
src string Absolute path of mobile image
}
thumbnail struct thumbnail image (max 200px)
{
src string Absolute path of thumb image
}
raw struct The raw original image if the original was png/gif/pdf
{
src string Absolute path of raw original image
}
ratio float width-height ratio of image = height / width
focus struct user-selected position of most importance
{
x float 0-1 - 1 is far right, 0 far left
y float 0-1 - 1 is top, 0 bottom
}
}
Video Struct
Data for embedding youtube/vimeo videos
{
id string youtube|vimeo id
type int Type of video
0 - Vimeo
1 - Youtube
2 - HTML5
}
Video Data Struct
This is only available when item is an HTML5 video
{
baseName string unique filename base
versions struct available video versions
{
mp4High struct Best quality mp4
mobile struct low quality mp4
webM struct high quality webm
thumbnails struct auto-generated thumbnails
}
}
HTML5 Struct
This is automatically generated by Zencoder
{
id string unique id for video
url string absolute path to video
duration_in_ms int total duration of video
height int height in px
width int width in px
...
thumbnails array
[
{
label string
images array
[
{
url string
format string
dimensions string
}
]
}
]
}
Special Offer Struct
A Special Offer
{
id int blog post id
slug string the url fragment for this offer
featuredImage struct featured image for this section (Image)
title string Offer title
description string Offer description
tAndCs string HTML-formatted text for Terms And Conditions relating to offer
htmlTitle string text for the brower tab title
metaDescription string text for the meta description for the page
validFrom string date formatted YYYY-MM-DD hh:ii:ss
validTo string date formatted YYYY-MM-DD hh:ii:ss
updatedAt string last saved date
}
Blog Post Struct
An individual blog post
{
id int blog post id
body string raw body before widgets have been rendered
N.B. use renderedBody instead for templating
category_id int the id of the parent page
featuredImage struct featured image for this section (Image)
gallery array list of images for the gallery
[
Item struct
]
htmlTitle string text for the brower tab title
metaDescription string text for the meta description for the page
postDate string date formatted YYYY-MM-DD hh:ii:ss
published bool whether page has been published
renderedBody string body to display once widgets have been rendered
slug string url fragment for this post
link string absolute href of this post
summary string text summary for blog pst
tags string comma delimited list of tags
title string Blog title
customFields struct key-value hash of custom data for this page
{
fieldKey string: CustomFieldStruct The format of this struct is structured according to what is described in customFieldDescription
...
}
customFieldDescriptions struct key-value hash describing custom field types
{
fieldKey string: CustomFieldDescription Struct data as described in customFieldDescriptions
...
}
updatedAt string last saved date
}
Meal Struct
One of the meal menus on a food menu page
{
id int meal id
published bool whether page has been published
title string Title of the meal e.g Breakfast
description string An optional description about this meal contains HTML *
content string The meal data type:
dishes where dishes/courses are itemised
text for free text
courseOrder array list of courses if contentType dishes
[
Course struct
]
body string raw body text if contentType text
timePeriod string morning, afternoon, evening allday
publishedDate string Date meal is set for
updatedAt string last saved date
}*
Course Struct
A section in a meal e.g "Starters"
{
id int course id
title string course title e.g. Pasta
description string course description - can contain HTML
dishOrder array list of dishes in this course
[
Dish struct
]
}
Dish Struct
An individual dish in a meal e.g "Poached Eggs"
{
id int dish id
title string dish title e.g. Roast Beef
ingredients string list of ingredients eg 'potatoes, hollandaise sauce, fennel'
price string price e.g. '£10.50' or '10.50' etc
}
Voucher Struct
The data for templating voucher.html and voucherEmail.html
{
id int System id for voucher
price float Price of the voucher
currency string 3 letter currency code
senderName stringName of the voucher sender
addressee string Person to whom voucher is being given
message string Message on voucher
code string Voucher code that can be used in the restaurant for redeeming the voucher
webHash string Long, random identifier of the voucher (for generating url for voucher) - would be
Email Settings Struct
The global settings for sending voucher emails
{
purchasedMessage string Message from staff in email, e.g 'Thank you for buying a voucher from us'
senderEmail string Email address email will be sent from *
senderName string Name of the email address it will be sent from
}*
Custom Field Description Struct
This struct describes the types that are to be expected in the customField section
{
id: string; // the field key in the `customFields`
description: string; // a human-readable description of the field
type: 'gallery' // an array of images
| 'image' // a single image
| 'checkbox' // a boolean
| 'text' // a simple string
| 'file' // a file struct
| 'formattedText' // a text string which is raw HTML
| 'complex' // an array of elements defined in `fields`
primaryField: string; // when the type is `complex` this is the field of the `fields` array which each result is indexed by
fields: [ // when type is `complex` we define an array of subfields which apply to each item in the list
{
id: string; // field key
description: string; // human readable description
type: 'text'| 'image' | 'formattedText' | 'checkbox' | 'gallery' | 'file'
}
]
}
Custom Field Struct
A flexible data format for custom data
The corresponding data type for each custom field is defined in customFieldDescriptions.
The types are one of:
Text Field
{
// ...
customFields: {
// ... other fields
textField:"some text"
},
customFieldDescriptions: {
// ... other fields
textField: {
id:"textField",
description: "A Text Field"
type: "text",
},
}
}
Image Field
{
// ...
customFields: {
// ... other fields
imageField:{ // image struct
large: {
src: string;
},
mobile: {
src: string;
}
thumbnail: {
src: string;
}
raw: {
src: string;
}
ratio: number;
focus: {
x: number;
y: number;
}
}
},
customFieldDescriptions: {
// ... other fields
imageField: {
id:"imageField",
description: "An uploaded image"
type: "image",
},
}
}
Checkbox field
{
// ...
customFields: {
// ... other fields
checkboxField: false,
},
customFieldDescriptions: {
// ... other fields
checkboxField: {
id:"checkboxField",
description: "A boolean field"
type: "checkbox",
},
}
}
Complex Field
This is a store of custom lists of multiple structured items need to be added to a page
{
customFields: {
aComplexArray: [
{
title: 'item-1',
description: '<div>some formatted <span>html</span></div>',
},
{
title: 'item-2',
description: '<div>some other formatted <span>html</span></div>',
},
]
},
customFieldDescriptiosn: {
aComplexArray: {
id: 'aComplexArray',
description: 'Your Items',
fields: [
{
id: 'title',
type: 'text',
description: 'title',
},
{
id: 'description',
type: 'formattedText',
description: 'Description',
}
],
primaryField: 'title',
}
}
}