Added examples

This commit is contained in:
Karl Brightman 2011-09-16 11:37:48 +08:00
parent 75f4835d3e
commit 769b0569db
1 changed files with 18 additions and 0 deletions

View File

@ -9,10 +9,28 @@ module Locomotive
self._source._id.to_s self._source._id.to_s
end end
# Returns the next content for the parent content type.
# If no content is found, nil is returned.
#
# Usage:
#
# {% if article.next %}
# <a href="/articles/{{ article.next._permalink }}">Read next article</a>
# {% endif %}
#
def next def next
self._source.next.to_liquid self._source.next.to_liquid
end end
# Returns the previous content for the parent content type.
# If no content is found, nil is returned.
#
# Usage:
#
# {% if article.previous %}
# <a href="/articles/{{ article.previous._permalink }}">Read previous article</a>
# {% endif %}
#
def previous def previous
self._source.previous.to_liquid self._source.previous.to_liquid
end end