Created
February 27, 2019 22:37
-
-
Save hamletbatista/f6e410601f9bcc767296a856e96e9d27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jinja2 import Template | |
sitemap_template="""<?xml version="1.0" encoding="UTF-8"?> | |
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
{% for page in pages %} | |
<url> | |
<loc>{{page[0]|safe}}</loc> | |
<lastmod>{{page[1]}}</lastmod> | |
</url> | |
{% endfor %} | |
</urlset>""" | |
template=Template(sitemap_template) | |
xml_sitemap_output=template.render(pages=df.itertuples()) | |
print(xml_sitemap_output[:500]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment