The following variables can be used on all pages; in addition, the mini cart is always available.
var (
// <link rel="alternate"> element to insert between <head> and </head> to
// indicate to browsers and search engines the alternate address to
// use for mobile devices.
alternate html
// Banners defined in the template.
banners Banners
// Blog posts.
blogPosts []BlogPost
// Blog tags.
blogTags []BlogTag
// Button to log in.
buttonLogin html
// Button to log out.
buttonLogout html
// Button to start a product search.
buttonSearch html
// Indicates whether the site language or currency can be changed.
canChangeLocale bool
// <link rel="canonical"> element to insert between <head> and </head> that
// indicates to browsers and search engines the canonical address of
// the current page.
canonical html
// Captcha. Prevents receiving spam emails.
captcha html
// Quantity of products in the cart.
cartQuantity html
// Cart total.
cartTotal html
// Cart total including VAT.
cartTotalTax html
// Additional collections.
collections []Collection
// Site currencies.
// In versions 7.0 and 7.1 it has type html.
currencies Currencies
// Current currency.
// Available starting from version 7.2.
currency Currency
// Customer email, if logged in.
customerEmail html
// Customer first name, if logged in.
customerFirstName html
// Identifier of the customer's customer group or
// the main customer group if the customer is not logged in.
customerGroup int
// Customer last name, if logged in.
customerLastName html
// Provides a department given its identifier.
departmentByID map[int]Department
// Main departments and their children.
departments []Department
// Footer notes.
footnote html
// Provides data passed in the HTTP request via query and body.
// Values and files passed as "multipart/form-data" are available only
// after the ParseMultipart method has been called.
form FormData
// Indicates whether the current page has the department filter.
hasDepartmentsFilter bool
// Indicates whether the current page has the producer filter.
hasProducersFilter bool
// Indicates whether the current page is the first in a pagination.
// Available only if Paranoid SEO is enabled.
isFirstPage bool
// Indicates whether the customer is logged in.
isLoggedIn bool
// Language code to use as the value of the lang attribute.
// In version 7.0 it is available only if Paranoid SEO is enabled.
// Deprecated: use language.Code instead.
lang string
// Current language.
// Available starting from version 7.2.
language Language
// Site languages.
// In versions 7.0 and 7.1 it has type html.
languages Languages
// Site logo for desktop devices.
logo LinkedImage
// Menus defined in the template.
menus Menus
// Store reviews.
// Available in version 7.1 and later.
merchantReviews []Review
// Total number of store reviews.
// Available in version 7.1 and later.
merchantReviewsCount int
// Meta description to insert between <head> and </head>. Available only if
// Paranoid SEO is enabled.
metaDescription html
// Meta tags to insert between <head> and </head>.
metaTags html
// Site logo for mobile devices.
mobileLogo LinkedImage
// Template HTML page name without the extension.
page string
// Page number when the current page is part of a
// pagination. Available only if Paranoid SEO is enabled.
pageNumber PageNumber
// Page title to insert between <head> and </head>.
pageTitle string
// Reference to the ecommerce platform used.
poweredBy html
// Producers menu.
producerMenu html
// Producers.
producers []Producer
// Menu to choose the department to search in.
searchDepartment html
// Resources (product, department, producer, etc.) the page refers to.
resources []Resource
// Indicates whether taxes are excluded from prices.
taxesAreExcluded bool
// Page title.
title html
// Best-selling products.
topSellers []Product
// Number of columns used to show top sellers.
topSellersColumns int
)
The banners variable, of type Banners, lets you show the template banners on the site.
For example, to show the banners of the location named SlideShow you would write:
{% for image in banners.SlideShow.Images %}
{{ image }}
{% end for %}
The menus variable, of type Menus, lets you show the template menus on the site.
For example, to show the menu for the Company section you would write:
<h3>{{ menus.Company.Title }}</h3>
<ul>
{% for item in menus.Company.Items %}
<li>{{ item }}</li>
{% end for %}
</ul>
The topSellers variable contains the best-selling products:
{% for product in topSellers %} .. {% end for %}
For more details, see the documentation for the Product type.
Generic pages are pages without specific functionality on the site. You can create as many as you want. The provided templates include pages such as page.html, privacy-policy.html, and terms-of-service.html.
To manage the title, content, and indexing information directly from the admin, you can use the following variables in addition to those available on all pages:
var (
// Content.
content html
// Image.
image AlignedImage
// Title.
title string
)