-
Notifications
You must be signed in to change notification settings - Fork 131
Variables
t as in ttttttt edited this page May 28, 2014
·
6 revisions
Within the templates files, we also have access to any variables defined within the .yml file that corresponds to the current page. These can be accessed directly on the page object. ie. {{ page.title }}
In addition, any variables defined in /content/_shared.yml are available within all template files.
These are created for each page within the site.
page.root_path | Will output a relative path from the current page to the root of the site. ie. in /projects/project-name/ page.root_path will contain ../../ . |
page.file_path | Outputs the system relative path of the current page (ie. ./projects/1.project-1 ). |
page.thumb | Outputs the thumbnail (as an image) for this page (if a file named thumb.jpg , thumb.gif or thumb.png exists with the page folder). Access the url with page.thumb.url . |
page.url | Outputs the relative path to this page from the page currently being viewed (ie. ../../projects/project-1 ). |
page.permalink | Outputs the absolute url path of the current page (ie. projects/project-1 ). |
page.slug | Outputs the slug of the current page (ie. project-1 ). |
page.is_current | Returns true if page.permalink matches the server’s request uri. |
page.is_first | Returns true if current page is the first in its collection. |
page.is_last | Returns true if current page is the last in its collection. |
page.page_name | Outputs the name of the current page. This is constructed by converting the page’s slug into title-case text (ie. test-project-1 becomes Test Project 1 ). |
page.siblings_count | The number of pages sitting at the same level as this page (ie. 12 ). |
page.children_count | The number of children below this page (ie. 12 ). |
page.index | The number of the current page, relative to the other pages sitting at the same level (ie. 5 ). |
page.current_year | Will output the current year. |
page.domain_name | Will output the domain name of the current site (ie. staceyapp.com ). |
page.base_url | Will output the domain name & folder path stacey is running from (ie. staceyapp.com/stacey ). |
page.site_updated | Will output the date the site was last edited in the RFC 3339 format (ie. 2009-12-12T17:34:23+11:00 ). |
page.template_name | Will output name of the template used in the current page. (ie. project ). |
page.updated | Will output the date the current page was last edited in the RFC 3339 format (ie. 2009-12-12T17:34:23+11:00 ). |
page.stacey_version | Will output the version of stacey you are running (ie. 3.0 ). |
These variables can be used from within your text files.
path | Will output the full file system path to the current page. (ie. /content/3.about ) |
bypass_cache | If set, this will bypass stacey's caching mechanisms for this page. |