Skip to content

Instantly share code, notes, and snippets.

View alexshchegretsov's full-sized avatar
🏠
Working from home

Alexander Shchegretsov alexshchegretsov

🏠
Working from home
  • Wrocław, PL
View GitHub Profile
@Julian-Nash
Julian-Nash / flask_sitemap_generator.py
Last active May 4, 2024 13:03
Flask dynamic sitemap generator
@app.route("/sitemap")
@app.route("/sitemap/")
@app.route("/sitemap.xml")
def sitemap():
"""
Route to dynamically generate a sitemap of your website/application.
lastmod and priority tags omitted on static pages.
lastmod included on dynamic content such as blog posts.
"""
from flask import make_response, request, render_template