I don't think this is the right solution. What you've done is this:
```
<a href="someurl">{% if ... %}Go to this link{% endif %}</a>
```
which could render as 
```
<a href="someurl"></a>
```
depending on the if statement. 
In fact, the if statement is not correct. You add an `if` and and `else` but then it must be missing an `endif` somewhere.