Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to apply an external url with django template

I am new to Django. I want to ask a basic question.

I have an anchor tag in the template

<a href="www.abc.com">website</a>

when I get the rendered template in the webpage, I get an url like this:

www.mydomain.com/my_current_page/www.abc.com

and actually it goes to the same url, while in html I can only find the href to be equal to:

www.abc.com

I also added target=_blank to open in the new page. Is this fine the way I am doing this?

like image 440
A.J. Avatar asked Oct 24 '25 04:10

A.J.


1 Answers

You'll need to declare the anchor like this:

<a href="http://www.abc.com">website</a>

Otherwise the browser will interpret it like a relative url and will happen what you just explained.

like image 136
Paulo Bu Avatar answered Oct 26 '25 19:10

Paulo Bu