In Flask, I have main/routes.py using Flask blueprints
from flask import render_template, request
from app.main import bp
@bp.route('/')
def index():
return render_template('index.html')
In templates/base.html, I have
<a href="{{ url_for('main.index') }}">Contact</a>
In templates/index.html, I have
<div id="contact">Contact Us</div>
I’d like to go to #contact
and have rendered
mysite.com/#contact
Is this possible? Modify render_template? url_for? Something else?
Thank you for any insight.
I tried href="{{ url_for('main.index', id='#contact') }}"
but couldn’t see how to proceed.
martin1959 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.