Issue
This Content is from Stack Overflow. Question asked by JAGADEESH UNDAVALLI
I am trying to include my GitHub page in the html file using anchor tag.
But the jinja
library of flask isn’t allowing :
which is a part of url.
Is there a way to use anchor tags that reflects external existing websites?
My code is as follows:
<a id="bot" target="_blank" href="{{url_for(https://github.com/<user_name>)}}">
Thanks in advance
Solution
url_for
is for generating a URL to an end point within your Flask application.
For external URLs, just use the URL. It doesn’t need calculating since external URLs are fixed (at least generally, if you need to link to different external URLs from your development/staging/production environments then you’ll need logic to handle that, but not url_for
).
href="https://github.com/example">
This Question was asked in StackOverflow by JAGADEESH UNDAVALLI and Answered by Quentin It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.