INNER CODE UNIT · Python
full_path
netkiller/netkiller.github.io · generate_sitemaps.py:55
full_path = OUTPUT_DIR / rel_path
lastmod = get_lastmod(full_path)
url_path = url_encode_path(rel_path)
lines.append(' <url>')
lines.append(f' <loc>{BASE_URL}/{url_path}</loc>')
lines.append(f' <lastmod>{lastmod}</lastmod>')
lines.append(' </url>')
lines.append('</urlset>')
with open(OUTPUT_DIR / 'sitemap.xml', 'w', encoding='utf-8') as f:
f.write('\n'.join(lines))
print(f"Generated sitemap.xml with {len(html_files)} URLs")
def generate_sitemap_txt(html_files):
"""Generate sitemap.txt."""