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

<pre><code>{{ entry.parent ? entry.parent.link }}
</code></pre>

<p><a href="http://buildwithcraft.com/docs/templating/entrymodel#link"><code>entry.link</code></a>, or <code>entry.getLink()</code> gives you the <code>&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;</code> part.</p>

CC BY-SA 3.0
2014-10-02T15:31:15.957Z
wonderful > {{ entry.parent.url }} was all i'm looking for
eek-a-edge
CC BY-SA 3.0
2014-10-02T15:04:57.863Z
2014-10-02T15:04:57.863Z
Paul
<p>Is there a tag that can shorten the following:</p>

<pre><code>{% set parentPage = entry.getParent() %}
{% if parentPage %} &lt;a href="{{ parentPage.url }}"&gt;{{ parentPage.title }}&lt;/a&gt;
{% endif %}
</code></pre>

<p>Something like <code>{entry.getParentUrl}</code>?</p>

<templating><url>
Is there a tag to get the parents url like {{entry.url}}?
# Is there a tag to get the parents url like {{entry.url}}?

(Asked by: username_0 on 2014-10-02)

Is there a tag that can shorten the following:
{% set parentPage = entry.getParent() %}
{% if parentPage %} {{ parentPage.title }}
{% endif %}

Something like {entry.getParentUrl}?

**Tags:** templating, url


---

## 1 answers

### Answer by username_1 on 2014-10-02. Score: 10 | Accepted answer

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 {{ entry.title }} part.

> **Comments:**
> **username_0**: wonderful > {{ entry.parent.url }} was all i'm looking for  

---

