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}?


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
    wonderful > {{ entry.parent.url }} was all i'm looking for – eek-a-edge Oct 2 '14 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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