Why am I getting "Variable "entry" does not exist"
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:

&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;