New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use with dynamic routes ? #4
Comments
Hi, I have not given much thought to dynamic routes so far in flask-sitemapper, which should definitely change! I am not sure if it is currently possible to use flask-sitemapper with dynamic routes - I will look into this and let you know - and add better support for this. What is your expected behaviour for adding a dynamic route to the sitemap? Do you intend to provide a list of values for the URL variable(s) ( @sitemapper.include(slug=["a", "b", "c", "d"])
@blueprint_galleries.route("/gallery/<string:slug>", methods=['GET'])
def gallery(slug):
... Which lists the following URLs in the sitemap:
Or something else? Thanks |
Hi, thanks for fast reply. Mhhh i´m not sure what's really the best choice to do it, but lists seems to be fine. Maybe as alternativ a additional "append to sitemapp" function would also work. So the user can do something like this...
In this both contexts some kind of caching the sitemap would be great. Kind regards. |
I have made some changes on the main branch: flask-sitemapper now supports dynamic routes as explained here, and now caches the sitemap's XML when it is first generated.
Feel free to let me know what you think of this approach and if it works for you! These changes will be included in the next release (probably 1.6.0) Thank you! |
Hi,
i want to use flask-sitemapper for static and some dynamic routes together with blueprints.
I defined a instance of sitemapper in a separate file like describe in documentation and import this instance in every blueprint.
In mainfile i initialize the instance with "app" after i registered the blueprints.
This works well for all static routes like e.g. "/", "/about" etc.
But it failed for all dynamic routes like:
Error Message from werkzeug:
werkzeug.routing.exceptions.BuildError: Could not build url for endpoint 'blueprint_galleries.gallery'. Did you forget to specify values ['slug']?
I have no idea how i can solve this or use flask-sitemapper with dynamic routes.
I don't found anything about it in documentation.
Any help or hints would be great.
Thanks in advanced!
The text was updated successfully, but these errors were encountered: