{% extends 'layout.html' %} {% set crumbs = (('Docs',), ('Templates',)) %} {% set toc = ( ('Data', ( ('Globals', ( ('containers',), ('posts',), ('site',) )), ('Locals', ( ('archive',), ('item',), ('tag',) )) )), ('Filters', ( ('absolutize',), ('date',), ('items',), ('values',) )), ('Helpers', ( ('get_asset',), ('get_url',) )) ) %} {% block content %}

# Data

## Globals

containers

  A dictionary of the defined content containers.

  containers[container]

    An object of the container's items as well as archives and tags dictionaries.

    Iterating over the container yields it's items.

    container.archives

      A dictionary of the container's archive data.

          {% raw %}{% for archive in container.archives|values %}
              <h1>{{ archive.year }}</h1>
              <ul>
                  {% for month, posts in archive.months|items %}
                      <li>
                          <h1>{{ month }}</h1>
                          <ul>
                              {% for post in posts %}
                                  <li>{{ post.timestamp|date('%d') }} – <a href="{{ get_url(post.url) }}">{{ post.title }}</a></li>
                              {% endfor %}
                          </ul>
                      </li>
                  {% endfor %}
              </ul>
          {% endfor %}{% endraw %}

    container.items
      A list of the container's items.
    container.tags

      A dictionary of the container's tags.

          {% raw %}{% for tag in container.tags|values %}
              <li><a href="{{ get_url(tag.url) }}">{{ tag.name }} ({{ tag.count }})</a></li>
          {% endfor %}{% endraw %}

posts
  A container object of the site's posts.
site
  A dictionary of the site's config data.

## Locals

archive

  A dictionary of archive data.

  This variable is only available in `archive_layout` templates.

  archive.months
    A dictionary of items sorted by month in reverse chronological order.
  archive.url
    The URL to the year's archive page based on the `archives_url` config setting.
  archive.year
    The year of the archive.
item

  A dictionary of item data.

  This variable is only available in `layout` templates.

  item.content
    The body of the item.
  item.date
    The date of the item formatted according to the `date_format` config setting.
  item.excerpt

    The contents of the first `<p>` of content.

    Only available for container items.

  item.prev
    The previous item in the container.
  item.next
    The next item in the container.
  item.tags

    A list of the item's tags.

    Only available for container items.

  item.timestamp
    The timestamp of the item.
  item.url
    The URL of the item formatted according to the appropriate URL format.
tag

  A dictionary of tag data.

  This variable is only available in `tag_layout` templates.

  tag.archives
    An archive containing only posts belonging to the tag.
  tag.count
    The number of tagged items.
  tag.name
    The name of the tag.
  tag.posts
    A list of the tag's items.
  tag.url
    The URL to the tag page based on the `tags_url` config setting.

# Filters

absolutize(html)

  Attempts to convert all URLs in the supplied HTML to absolute URLs.

  This filter depends on the `domain` config setting.

  html
    The chunk of HTML to convert.
date(ts, format)

  Returns a formatted date based on the supplied timestamp and format.

      {{ '{{ post.timestamp|date(\'%d %b %Y\') }}' }}

  ts

    The timestamp to be formatted.

    If `None`, the current date and time will be used.

  format
    The desired format of `ts`.
items(dict)
  Syntactic sugar for dict.iteritems().
values(dict)
  Syntactic sugar for dict.itervalues().

# Helpers

get_asset(asset)

  Returns the URL to the asset based on the `base_url` and `assets_url` config settings.

      <link rel="stylesheet" href="{{ '{{ get_asset(\'css/screen.css\') }}' }}" type="text/css">

  asset
    The requested asset.
get_url(url, absolute)

  Returns a URL based on the `base_url` config setting.

      <a href="{{ '{{ get_url(post.url) }}' }}">{{ '{{ post.title }}' }}</a>

  url

    The requested URL.

    This parameter is optional. If not supplied, the `base_url` config setting will be returned.

  absolute

    Whether or not the returned URL should be an absolute URL.

    This depends on the `domain` config setting.

{% endblock %}