Jabda
Jabda

Reputation: 1792

Django Templates: External link with variable

This link is an external site link, all solutions I found mention an internal link with static or variables

In the HTML

<a href="https://externalsite.com/page1/page2/assetId="/{{varID}}/">{{varName}}/a>

It always comes up with a spaces around varID. I tried Trimming the variable. I tried escaping with /.

This is what it looks like in browser inspect

 <a href="https://externalsite.com/page1/page2/assetId="   1234  ">myAsset</a>

this is what the url is when you click on it

https://externalsite.com/page1/page2/assetId=

Upvotes: 0

Views: 1471

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599610

You don't need the quotes and slashes. Just put the variable inside the string.

Edit

<a href="https://externalsite.com/page1/page2/assetId={{varID}}">{{varName}}</a>

Upvotes: 6

Related Questions