====== Liquid Templates ====== Built on the [[Liquid]] markup language, Liquid templates are what tell SandwichBoard how to render restaurants' web sites. What follows is a detailed description of each template found in a [[themes|SandwichBoard theme]]. ===== layout.liquid ===== This is the outermost template for a site. This is where the restaurant name, logo, site navigation, and copyright information would typically go. All other templates and pages are rendered inside it and are called by ''%%{{content_for_layout}}%%''. Example: {{ title }} - {{ restaurant.name }} {{ 'site' | stylesheet }} {{ 'page' | stylesheet }} {{ 'print' | stylesheet: 'print' }} {% if image %} {{ 'prototype' | javascript }} {{ 'scriptaculous.js?load=effects,builder' | javascript }} {{ 'lightbox' | javascript }} {{ 'lightbox' | stylesheet }} {% endif %}

{{ restaurant.name | upcase }}

{% if restaurant.has_multiple_menus %} {% endif %}
{{ restaurant.stats_tracker }} ===== menu.liquid ===== Every menu's web page is generated by this template. You use the ''menu'' [[menu drop|Liquid drop]] and its attributes to build the resulting page detailing the menu. Example: ===== error.liquid ===== If a Liquid template generates an error or if a user navigates to a page that doesn't exist, this template is used to tell the user that something has gone awry. You can access the Liquid error ''message'' from this template. Example:

An error has occurred

{{ message }}

===== locations.liquid ===== This template is used to build the web page that displays a concise list of all a restaurant's locations. You use the ''locations'' Liquid collection, its [[location drop|location Liquid drops]], and their attributes to build the resulting page. Example: {% for location in locations %} {% endfor %}

{{ location.name }}

{{ location.street_address }}, {{ location.city }}, {{ location.state }} {{ location.zip }}
{% if location.email or location.phone %}
{% if location.email %} {% endif %} {% if location.phone %}
Phone: {{ location.phone }}
{% endif %}
{% endif %}
===== location.liquid ===== Every restaurant location's web page is generated by this template. You use the ''location'' [[location drop|Liquid drop]] and its attributes to build the resulting page detailing the location and its hours of operation. Example:
{% if location.gmap_url %}

View Larger Map
{% endif %}

Address

{{ location.street_address }}
{{ location.city }}, {{ location.state }} {{ location.zip }}
{% if location.email or location.phone or location.fax %}
{% if location.email %} {% endif %} {% if location.phone %}
Phone: {{ location.phone }}
{% endif %} {% if location.fax %}
Fax: {{ location.fax }}
{% endif %}
{% endif %} {% for schedule in location.schedules %}

{{ schedule.name }}

{% for entry in schedule.entries %} {% endfor %}
{{ entry.days }}{{ entry.hours }}
{% endfor %} {% if location.notes %}

Additional Information

{{ location.notes | simple_format }}
{% endif %}
===== albums.liquid ===== This template is used to build the web page that displays a concise list of all a restaurant's albums. You use the ''albums'' Liquid collection, its [[album drop|album Liquid drops]], and their attributes to build the resulting page. Example: {% for album in albums %} {% endfor %}
({{ album.images | size | pluralize: 'Image' }})

{{ album.name }}

{% if album.date %}
{{ album.date | date: '%B %e, %Y' }}
{% endif %}
{{ album.description }}
===== album.liquid ===== Every restaurant album's web page is generated by this template. You use the ''album'' [[album drop|Liquid drop]] and its attributes to build the resulting page showing the album and its images. Example:
{% if album.date or album.description %}
{% if album.date %}
{{ album.date | date: '%B %e, %Y' }}
{% endif %} {% if album.date %}
{{ album.description }}
{% endif %}
{% endif %}
{% for image in album.images %}
{% endfor %}
===== image.liquid ===== Every album's image web page is generated by this template. You use the ''image'' [[album drop|Liquid drop]] and its attributes to build the resulting page showing the image and its comments. Example:
Back to {{ image.album.name }} Album

{{ image.comments | size | pluralize: 'Comment'}}

{% if image.comments %}
{% for comment in image.comments %}

{{ comment.body }}

{% endfor %}
{% endif %}

Make a Comment

{% commentform %}

(required)
{{ form.name }}

(required but will not be published)
{{ form.email }}


{{ form.url }}

(required)
{{ form.body }}

{% endcommentform %}