Page Templates

Create an HTML page, then replace any page-specific content in your code with template tags.

First Things First

Start out by designing the look and feel for your store, including the header, navigation menus and footer. You can design and create your HTML page in any HTML or WYSIWYG Editor that you are comfortable working with.

Required Tags

Every page template has two required tags, the opening and closing tags that indicate to ShopSite that the template file is for a page. At the very top of your HTML, before the DOCTYPE tag add [-- DEFINE PAGE --], and at the every end of your HTML page, after </html> add [-- END_DEFINE PAGE --].


Suggested VARs

ShopSite allows you to setup your own custom variables (custom template tags) to use throughout your template. Below are some suggested VAR tags that many designers add to all their custom ShopSite page templates. Add these tags immediately after the [-- DEFINE PAGE --] tag, above your DOCTYPE.

[-- VAR.Secure "no" --]
[-- VAR.Type "page" --]
[-- IF PAGE.LinkColumns "One column" --][-- VAR.LinkWidth "full" --][-- VAR.MaxLink "1" --][-- ELSE_IF PAGE.LinkColumns "Two columns" --][-- VAR.LinkWidth "half" --][-- VAR.MaxLink "2" --][-- ELSE_IF PAGE.LinkColumns "Three columns" --][-- VAR.LinkWidth "third" --][-- VAR.MaxLink "3" --][-- ELSE_IF PAGE.LinkColumns "Four columns" --][-- VAR.LinkWidth "fourth" --][-- VAR.MaxLink "4" --][-- ELSE --][-- VAR.LinkWidth "fifth" --][-- VAR.MaxLink "5" --][-- END_IF --]
[-- IF PAGE.Columns "One column" --][-- VAR.ProductWidth "full" --][-- VAR.MaxProduct "1" --][-- ELSE_IF PAGE.Columns "Two columns" --][-- VAR.ProductWidth "half" --][-- VAR.MaxProduct "2" --][-- ELSE_IF PAGE.Columns "Three columns" --][-- VAR.ProductWidth "third" --][-- VAR.MaxProduct "3" --][-- ELSE_IF PAGE.Columns "Four columns" --][-- VAR.ProductWidth "fourth" --][-- VAR.MaxProduct "4" --][-- ELSE --][-- VAR.ProductWidth "fifth" --][-- VAR.MaxProduct "5" --][-- END_IF --]

Title & Meta Tags

For SEO purposes, all pages should have their own unique title and meta description tags within the <head></head> portion of a web page. These fields, as well as the less-used meta keywords field, are all fields that are part of the ShopSite page database. You can use template tags to check to see if there is a value in the database field for the title, meta description or meta keywords, and use that value if it exists. You can also add ELSE tags to use the page name or another page field if one of these fields is blank. Copy the code below and include it within the <head></head> section of your HTML page.

[-- IF PAGE.Title --]
  [-- PAGE.Title --]
[-- ELSE --]
  [-- PAGE.Name REMOVE_HTML --]
[-- END_IF --]

[-- IF PAGE.MetaKeywords --]
[-- END_IF --]

[-- IF PAGE.MetaDescription --]
[-- END_IF --]

Stylesheets & Scripts

Within the <head> section of your templates you will want to link to your website CSS stylesheets and JavaScript files. You can do this by first uploading those files into the ShopSite Publish File section found under Merchandising > Custom Templates > Includes > Upload A Publish File. Then to link to those publish files, use the regular store URL, the /publish directory, then the name of the file.

  1. Add File To ShopSite. First you will want to go to Merchandising > Custom Templates > Includes, and upload your file into the second section, "Publish Files."
    Note: You will want to retain the ".css" ending on the file.

  2. Link To File Within Templates. You will need to link to this CSS file in all template types.
    • Pages: <link rel="stylesheet" type="text/css" href="[-- OUTPUT_DIRECTORY_URL --]/publish/name_of_css_file.css">
    • Secure Pages: <link rel="stylesheet" type="text/css" href="[-- STORE.SC_Secure_Image_URL --]/publish/name_of_css_file.css">

Note: These CSS and JavaScripts files work the same as regular CSS files with 2 exceptions, (1) they can use global ShopSite template tags such as [-- STORE.Color1 --] and [-- STORE.Font --] and (2) if a line starts with a pound sign "#" then the whole line is commented out. If you are setting CSS IDs you will want to put a space in front of the pound sign so that the pound sign is not the first thing on that row.

Header & Footer

[-- IF STORE.UseCompanyLogo --][-- STORE.CompanyLink --][-- END_IF --]

[-- IF STORE.HeaderImage --][-- STORE.HeaderLink --][-- END_IF --]

[-- IF PAGE.DisplayPageHeader --][-- HEADER --][-- END_IF --]

[-- IF PAGE.DisplayPageFooter --][-- FOOTER --][-- END_IF --]

Search Field

Below is the code to add to your custom page template in order to place the ShopSite search field on your ShopSite generated page.

Text & Graphics

For every page in ShopSite, merchants can choose to display the page name, add a banner graphic, and use up to 3 main text fields. Add the code shown below in place of "content goes here" in your HTML.

[-- IF PAGE.DisplayGraphic --]
 [-- IF PAGE.Graphic --]
[-- PAGE.Graphic ONLY_ALT_TAG --]
[-- END_IF --] [-- END_IF --] [-- IF PAGE.DisplayName --]

[-- PAGE.Name --]

[-- END_IF --] [-- IF PAGE.Text1 --]
[-- PAGE.Text1 --]
[-- END_IF --] [-- IF PAGE.Text2 --]
[-- PAGE.Text2 --]
[-- END_IF --] [-- IF PAGE.Text3 --]
[-- PAGE.Text3 --]
[-- END_IF --]

Most websites have top and side navigation menus that are the same on all pages. In the main content, a page may have sub pages or sub categories to help shoppers drill down to what they are interested in. For example, if you click on "shoes", you will come to a shoes page which may list "sandals" "high heels" and "sneakers" as sub pages.

Add the code below where you would like the sub pages to appear. Most often designers will put this code between the text fields 1 and 2 so that merchants can add text above the sub pages in text 1 and text below the sub page in text 2.

[-- IF PAGE.NumLinks GT "0" --][-- VAR.CountLinks "0" --]

[-- END_IF --]

In addition to adding the loop tags to loop through any assigned page links, you also need to define how you want your links to be laid out within the loop. Add the code shown below immediately AFTER the [-- END_DEFINE PAGE --] tag at the bottom of your template. This makes it so your page template now has two DEFINEs, one DEFINE for the page itself, and the second DEFINE for this page's link when listed on other pages. The 'loop' code shown above will loop through the DEFINE LINK_TO_PAGE code shown below, for all page links assigned to a page.

[-- DEFINE LINK_TO_PAGE --][-- VAR.CreateLink "yes" --]
[-- IF PAGE.LinkGraphic --]
  [-- PAGE.LinkGraphic ONLY_ALT_TAG --]
  [-- VAR.CreateLink "no" --]
[-- END_IF --]

[-- IF PAGE.LinkName --]
  [-- PAGE.LinkName --]
  [-- VAR.CreateLink "no" --]
[-- END_IF --]

[-- IF VAR.CreateLink "yes" --]
  [-- PAGE.Name REMOVE_HTML --]
[-- END_IF --]

[-- IF PAGE.LinkText --]
  [-- PAGE.LinkText --]
[-- END_IF --]

Loop Products

Now for the money maker section, the products. Most designers will add the tags to display the products between text fields 2 and 3 so that merchants can again add text above and below the products listed on a page.

[-- IF PAGE.NumProducts GT "0" --][-- VAR.CountProducts "0" --]

[-- END_IF --]

Page CSS

If you've been paying attention to the code you've been copying and pasting, you would have noticed that many of the DIVs have classes or IDs assigned. This is largely so that you can style the look and layout with CSS, but these classes and IDs also help with the structure of the page. It is suggested that you add the CSS below to the stylesheet for your page.

div#page-graphic {margin: 0px; padding: 0px 0px 20px 0px; text-align: center;}
div#page-graphic img {max-width: 100%;}
div.text, div#page-links, div#product-links {margin: 0px; padding: 20px 0px 0px 0px; text-align: left;}
div.text:after, div#page-links:after, div#product-links:after {content: ''; display: block; max-height: 1px; width: 100%; clear: both;} a, span {display: block;}, div.product {display: inline-block; zoom: 1; *display: inline;}
div.full {width: 100%; clear: both;}
div.half {width: 50%;}
div.third {width: 33.3%;}
div.fourth {width: 25%;}
div.fifth {width: 20%;}
div.clear {clear: both;}

Up Next: Create your product template.

Product Templates