Difference between revisions of "Page.liquid"

From Spiffy Stores Knowledge Base

 
Line 1: Line 1:
This template renders a [[Liquid Template Variables - page|page]].
+
This template renders a [[Liquid Template Variables - page|page]] or an [[Liquid Template Variables - article|article]]
  
 
This is usually the simplest of templates to build, and will consist of just the page content.
 
This is usually the simplest of templates to build, and will consist of just the page content.
Line 16: Line 16:
 
In '''page.liquid''' you have access to the following variables:
 
In '''page.liquid''' you have access to the following variables:
  
* [[Liquid Template Variables - page|page]] - The current page being displayed.
+
* [[Liquid Template Variables - page|page]] - The current page or article being displayed.
 
* [[Liquid Template Variables - handle|handle]] - The handle of the page.
 
* [[Liquid Template Variables - handle|handle]] - The handle of the page.
 +
 +
'''Note:''' The page variable may be either a [[Liquid Template Variables - page|page]] or an [[Liquid Template Variables - article|article]]. You can use the ''type'' attribute to distinguish which is which.
 +
 +
<pre>{{ page.type }} returns either 'page' or 'article'</pre>
  
 
In addition, all [[Liquid Variable Reference#Global objects|global variables]] are available.
 
In addition, all [[Liquid Variable Reference#Global objects|global variables]] are available.

Latest revision as of 09:58, 17 December 2008

This template renders a page or an article

This is usually the simplest of templates to build, and will consist of just the page content.

For example:

<div id="page">
  <h1>{{ page.title }}</h1>
  <div class="article textile">
    {{ page.content }}
  </div>
</div>

Variables

In page.liquid you have access to the following variables:

  • page - The current page or article being displayed.
  • handle - The handle of the page.

Note: The page variable may be either a page or an article. You can use the type attribute to distinguish which is which.

{{ page.type }} returns either 'page' or 'article'

In addition, all global variables are available.