<p>You can provide some fallbacks for pages that don't have en entry like this</p>

<pre><code>{{entry.title|default('here is your fallback')}}
</code></pre>

<p>You can do this multiple times, chaining fallbacks. Inside the fallback you can provide a global or maybe set a page at the top of your template like this:</p>

<pre><code>{% set entryFallback = craft.entries.id(1).first() %}
{{entryFallback.title}}
</code></pre>

<p><strong>Edit</strong></p>

<p>In your specific case where you just want to return the url from the page you are on to create a twitter share button, you can just get the current Url:</p>

<pre><code>&lt;a href="https://twitter.com/intent/tweet?url={{craft.request.url}}" class="social-link"&gt; &lt;i class="fa fa-twitter"&gt;&lt;/i&gt; 
</code></pre>

CC BY-SA 3.0
2017-01-27T16:37:41.263Z
2017-01-29T00:58:40.507Z
2017-01-29T00:58:40.507Z
Jan_dh
<p>This seems random to me, as it was not a problem until today...</p>

<p>I am getting the template error <code>Variable "entry" does not exist</code> with a reference to line<code>06</code> below.   </p>

<p>This is a template for social icons that I <code>include</code> on each page.</p>

<p>The code template below is included in my site template.  It works on the index page, but it works no where else other than an actual entry (post) page. </p>

<pre><code>&lt;a href="https://twitter.com/intent/tweet?url={{ entry.url }}" class="social-link"&gt; &lt;i class="fa fa-twitter"&gt;&lt;/i&gt; 
</code></pre>

CC BY-SA 3.0
2017-01-27T20:39:55.730Z
Would you mind cleaning up your code example a bit? This is pretty difficult to read. (ie: properly indent code, remove irrelevant tags)
Lindsey D
CC BY-SA 3.0
2017-01-27T20:50:25.827Z
Does that work?
Hellyar
<templating>
Why am I getting "Variable "entry" does not exist"
# Why am I getting "Variable "entry" does not exist"

(Asked by: username_0 on 2017-01-27)

This seems random to me, as it was not a problem until today...
I am getting the template error Variable "entry" does not exist with a reference to line06 below.   
This is a template for social icons that I include on each page.
The code template below is included in my site template.  It works on the index page, but it works no where else other than an actual entry (post) page.

**Tags:** templating
> **Comments:**
> **username_1**: Would you mind cleaning up your code example a bit? This is pretty difficult to read. (ie: properly indent code, remove irrelevant tags)  
> **username_0**: Does that work?  

---

## 1 answers

### Answer by username_2 on 2017-01-27. Score: 1 | Accepted answer

You can provide some fallbacks for pages that don't have en entry like this
{{entry.title|default('here is your fallback')}}

You can do this multiple times, chaining fallbacks. Inside the fallback you can provide a global or maybe set a page at the top of your template like this:
{% set entryFallback = craft.entries.id(1).first() %}
{{entryFallback.title}}

Edit
In your specific case where you just want to return the url from the page you are on to create a twitter share button, you can just get the current Url:


---

