Theme API

Functions

menus(page, start_level=1, end_level=15)

returns : html
description : Return a formatted ul tag with the menu contents. Active li’s have the active class on them.

example : {{ page | menus, 1, 1 }}

Account

name

returns : string
description : Returns the name of the account

example : <body id=“{{page.account.name}}”>

url

returns : string
description : Returns the account’s domain and subdomain if set, otherwise returns the site url as a subdomain.

example : Thank-you for visiting {{page.account.url}}!

url_id

returns : string
description : Returns the account’s unique subdomain chosen upon signup.

year

returns : string
description : Returns the current year.

example : © {{ page.account.year }} – All Rights Reserved

Page

id

returns : string
description : Returns a string with the current pages id

example : <h1 id=“page_{{page.id}}”>{{page.name}}</h1>

name

returns : string
description : Returns a string with the current page’s name

example : <body id=“{{page.name}}”>

description

returns : string
description : Returns a string with the current page’s description

example : <meta name="description" content="{{page.description}}">

meta

description : Returns a string with the current page’s description as a meta description tag.

usage : {{page.meta}}
returns : <meta name="description" content="I am the page’s description.">

url

returns : string
description : Returns a string of the current page’s url

example : <a href=“{{page.url}}”>{{page.name}}</a>

urlname

returns : string
description : Returns a string of the current page’s name formatted for URL.

example : {{page.urlname}}

permalink

returns : string
description : Returns the full path to this page including “http://” and domain name.

example : You may link to this page using {{page.permalink }}

level

returns : number
description : Return the depth of the current page. Root level is 0.

example : <div class=“level{{page.level}}” />

body

returns : string
description : Returns a string with the page’s body

example : {{ page.parent.last_sibling.body }}

account

returns : account (drop)
description : Return the account associated with the current page.

example : page.account

edit_link

returns : string
description : Returns URL to the edit mode of the current page

example : <a href=“{{ page.edit_link }}” id=“edit_link”>Edit</a>

admin_link

returns : string
description : Returns URL to the admin section for the current page

example : <a href=“{{ page.admin_link }}” id=“admin_link”>Admin</a>

root?

returns : boolean
description : Return true if page is a root page.

example : page.root?

root

returns : page (drop)
description : Returns the root ancestor of the current page.

example : page.root

has_children?

returns : boolean
description : Return true if page has any sub-pages.

example : {% if page.has_children? %}I have kids.{% end %}

children

returns : hash (of page drops)
description : Return a hash of the sub-pages of the current page.

example : {% if page.children? %} <em>I have {{page.children.length}} sub-pages.{% end %}

has_parent?

returns : boolean
description : Return true if the page has a parent page.

example : {% if page.has_parent? %} <strong>I have a parent.</strong> {% end %}

parent

returns : page (drop)
description : Return the parent page.

example : My Mom’s name is {{page.parent.name}}!

first_child

returns : page (drop)
description : Return the first child page.

example : My first child’s name is {{ page.first_child.name }}.

last_child

returns : page (drop)
description : Return the last child page.

example : My last child’s name is {{ page.last_child.name }}.

embed_code

returns : string
description : If the page has an embed_code module, this will get you the code for it if you need it.

example : {{ page.embed_code }}

has_embed_code?

returns : boolean
description : Returns true if this page has the embed code module.

example : {% if page.has_embed_code? %}I have embed code!!{% else %}No embed code!{% endif %}

has_gallery?

returns : boolean
description : Returns true if this page has the gallery module.

example : {% if page.has_gallery? %}I have a gallery!{% else %}No gallery!{% endif %}

has_sitemap?

returns : boolean
description : Returns true if this page has the sitemap module.

example : {% if page.has_sitemap? %}I have a sitemap!{% else %}No sitemap!{% endif %}

has_images?

returns : boolean
description : Return true if page has any images.

example : {% if page.has_images? %}I have images.{% end %}

images

returns : hash (of image drops)
description : Return a hash of the images attached to the current page.

example : {% for img in page.images %}<li><a href="/photos/{{img.id}}"><img src="{{ img.thumb_src }}" alt="{{img.title}}"/></a></li>{% endfor %}

first_image

returns : image (drop)
description : Return the first image attached to a page.

example : {{ page.first_child.first_image.title }}

last_image

returns : image (drop)
description : Return the last image attached to a page.

example : {{ page.last_image.title }}

breadcrumbs

returns: string
description: Returns an unordered list with CSS hooks for you to style a breadcrumb trail.

example: {% if page.level > 2 %} {{ page.breadcrumbs }} {% endif %}

outputs:

<ul class="breadcrumbs">
  <li class="some-more"><a href="/locations">Locations</a></li>
  <li class="some-more"><a href="/locations/canada">Canada</a></li>
  <li class="one-more"><a href="/locations/canada/british-columbia">British Columbia</a></li>
  <li class="last-one">Victoria</li>
</ul>

is_hidden?

returns : boolean
description : Return true if page is hidden from the menu navigation. This is set in the “Settings” tab in the page’s admin area.

example : {% if page.is_hidden? } I am a sneaky hidden page! { endif %}

Image

id

returns : string
description : Returns a string with the image id

title

returns : string
description : Returns a string with the title set by the person who uploaded the file

example : <img src="{{ page.first_image.thumb_src }}" alt="{{page.first_image.title}}" style="float:left"/>

description

returns : string
description : Returns a string with the description set on the image

example : <img src="{{ page.first_image.thumb_src }}" alt="{{page.first_image.description}}"/>

src

returns : string
description : Returns a string of the root-relative path to the image.

example : <img src="{{ page.last_image.src }}" alt="{{page.last_image.title}}"/>

thumb_src

returns : string
description : Returns a string of the root-relative path to the image.

example : <img src="{{ page.first_image.thumb_src }}" alt="{{page.first_image.title}}" style="float:left"/> Lorem ipsum dolar…