Added examples

This commit is contained in:
Karl Brightman 2011-09-16 11:37:48 +08:00
parent 75f4835d3e
commit 769b0569db

View File

@ -9,10 +9,28 @@ module Locomotive
self._source._id.to_s
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
self._source.next.to_liquid
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
self._source.previous.to_liquid
end