6

Is there a tag that can shorten the following:

{% set parentPage = entry.getParent() %}
{% if parentPage %} <a href="{{ parentPage.url }}">{{ parentPage.title }}</a>
{% endif %}

Something like {entry.getParentUrl}?

1 Answer 1

10

The shortest way, still checking if the parent exists, is to use (not tested):

{{ entry.parent ? entry.parent.link }}

entry.link, or entry.getLink() gives you the <a href="{{ entry.url }}">{{ entry.title }}</a> part.

1
  • 1
    wonderful > {{ entry.parent.url }} was all i'm looking for
    – eek-a-edge
    Oct 2, 2014 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.