mirror of
https://github.com/vinta/awesome-python.git
synced 2026-05-07 08:20:21 -05:00
feat(website): include group and subcategory URLs in sitemap
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -428,9 +428,11 @@ def build(repo_root: Path) -> None:
|
||||
llms_txt = build_llms_txt(llms_template, readme_text, stars_data)
|
||||
(site_dir / "robots.txt").write_text(build_robots_txt(), encoding="utf-8")
|
||||
sitemap_date = build_date.date().isoformat()
|
||||
sitemap_urls = [(SITE_URL, sitemap_date)] + [
|
||||
(category_public_url(category), sitemap_date) for category in categories
|
||||
]
|
||||
sitemap_urls = [(SITE_URL, sitemap_date)]
|
||||
sitemap_urls.extend((category_public_url(c), sitemap_date) for c in categories)
|
||||
sitemap_urls.extend((group_public_url(g["slug"]), sitemap_date) for g in parsed_groups)
|
||||
for cat_slug, sub_slug in sorted(seen_subcats):
|
||||
sitemap_urls.append((subcategory_public_url(cat_slug, sub_slug), sitemap_date))
|
||||
write_sitemap_xml(site_dir / "sitemap.xml", sitemap_urls)
|
||||
(site_dir / "index.md").write_text(markdown_index, encoding="utf-8")
|
||||
(site_dir / "llms.txt").write_text(llms_txt, encoding="utf-8")
|
||||
|
||||
@@ -195,9 +195,13 @@ class TestBuild:
|
||||
|
||||
---
|
||||
|
||||
**Tools**
|
||||
|
||||
## Widgets
|
||||
|
||||
- [w1](https://example.com) - A widget.
|
||||
- Sync
|
||||
|
||||
- [w1](https://example.com) - A widget.
|
||||
|
||||
# Contributing
|
||||
|
||||
@@ -225,11 +229,10 @@ class TestBuild:
|
||||
lastmods = [lastmod.text for lastmod in root.findall("sitemap:url/sitemap:lastmod", ns)]
|
||||
|
||||
assert root.tag == "{http://www.sitemaps.org/schemas/sitemap/0.9}urlset"
|
||||
assert locs == [
|
||||
"https://awesome-python.com/",
|
||||
"https://awesome-python.com/categories/widgets/",
|
||||
]
|
||||
assert len(lastmods) == 2
|
||||
assert "https://awesome-python.com/" in locs
|
||||
assert "https://awesome-python.com/categories/widgets/" in locs
|
||||
assert "https://awesome-python.com/categories/tools/" in locs
|
||||
assert "https://awesome-python.com/categories/widgets/sync/" in locs
|
||||
assert all(start_date <= date.fromisoformat(lastmod) <= end_date for lastmod in lastmods)
|
||||
assert all(loc.startswith("https://awesome-python.com/") for loc in locs)
|
||||
assert all("?" not in loc for loc in locs)
|
||||
|
||||
Reference in New Issue
Block a user