New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Item's relationships #69

Closed
yosymfony opened this Issue Feb 13, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@yosymfony
Copy link
Member

yosymfony commented Feb 13, 2016

This issue introduces the concept of relationships between items. Relationships are useful for setting a set of related items for a post or simply previous and next items in a sorted collection.
The ItemIterface interface has been updated with a new method: getRelationshipCollection. This method returns a RelationshipCollection object.

Spress adds prior & next relationships to each item belonging to a sorted collection referring to the previous and next items in the collection.

An example of use in a Twig template:

<ul>
    {% for rel in post.relationships.next %}
        <li>Next: <a href="{{ rel.url }}">{{ rel.title }}</a></li>
    {% endfor %}
    {% for rel in post.relationships.prior %}
        <li>Prior: <a href="{{ rel.url }}">{{ rel.title }}</a></li>
    {% endfor %}
</ul>

Note: Each relationship contains a set of items.

Additional tasks

Deals with issue #63

yosymfony added a commit that referenced this issue Feb 13, 2016

yosymfony added a commit to spress/spress.yosymfony.com that referenced this issue Mar 24, 2016

@yosymfony yosymfony closed this Mar 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment