Add a full list of pages to the site.
This CL modifies //scripts/export.py to write a list of all of
the content pages it exported to //site/pages.json. This can
be useful for reviewing the site, and at some point we might
want to adapt this into a sitemap as well.
Bug: 1267642
Change-Id: I749951a1379ecad7663c39589737a52916909097
Reviewed-on: https://chromium-review.googlesource.com/c/website/+/3270811
Auto-Submit: Dirk Pranke <dpranke@google.com>
Reviewed-by: Struan Shrimpton <sshrimp@google.com>
Commit-Queue: Dirk Pranke <dpranke@google.com>
diff --git a/scripts/export.py b/scripts/export.py
index 8fa6ab4..64a3c07 100755
--- a/scripts/export.py
+++ b/scripts/export.py
@@ -99,11 +99,13 @@
q = common.JobQueue(_handle_entry, common.cpu_count())
paths_to_export = set(paths_to_export)
+ exported_pages = set()
for i, entry in enumerate(list(entries.values())[:args.max_results]):
if entry['kind'] in ('webpage', 'listpage',
'announcementspage', 'filecabinet'):
metadata = _metadata(entry, entries, parents)
path = _path(entry, entries, parents)
+ exported_pages.add(path.rstrip('/') or '/')
elif entry['kind'] == 'attachment':
metadata = {}
path = entry['url'].replace(
@@ -121,6 +123,10 @@
if did_update:
updated += 1
+ if ret == 0:
+ common.write_text_file(
+ os.path.join(common.SITE_DIR, 'pages.json'),
+ json.dumps(sorted(exported_pages), indent=2) + '\n')
print('updated %d entries' % updated)
return ret