From 5f282a6267182214080ca36bcec4da1755589b46 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 19 Aug 2020 22:55:05 -0700 Subject: iterate on sitemap generation --- extra/sitemap/generate_sitemap_indices.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 extra/sitemap/generate_sitemap_indices.py (limited to 'extra/sitemap/generate_sitemap_indices.py') diff --git a/extra/sitemap/generate_sitemap_indices.py b/extra/sitemap/generate_sitemap_indices.py new file mode 100755 index 00000000..9766ac1f --- /dev/null +++ b/extra/sitemap/generate_sitemap_indices.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +import sys +import glob +import datetime + +def index_entity(entity_type, output): + + now = datetime.datetime.now().isoformat() + print("""""", file=output) + print("""""", file=output) + + for filename in glob.glob(f"sitemap-{entity_type}-*.txt.gz"): + print(" ", file=output) + print(f" https://fatcat.wiki/{filename}", file=output) + print(f" {now}", file=output) + print(" ", file=output) + + print("", file=output) + +def main(): + with open('sitemap-index-containers.xml', 'w') as output: + index_entity("containers", output) + with open('sitemap-index-releases.xml', 'w') as output: + index_entity("releases", output) + +if __name__=="__main__": + main() -- cgit v1.2.3