remove index.md

This commit is contained in:
Vinta Chen
2026-05-04 17:11:34 +08:00
parent 3510db9df9
commit 921d47b455
4 changed files with 7 additions and 19 deletions
-3
View File
@@ -290,7 +290,6 @@ def build_llms_txt(
contributing_url="https://github.com/vinta/awesome-python/blob/master/CONTRIBUTING.md",
sponsorship_url=SPONSORSHIP_PUBLIC_URL,
sitemap_url=SITEMAP_URL,
index_markdown_url=f"{SITE_URL}index.md",
categories_md=categories_md,
total_entries=total_entries,
total_categories=len(categories),
@@ -607,7 +606,6 @@ def build(repo_root: Path) -> None:
if static_src.exists():
shutil.copytree(static_src, static_dst, dirs_exist_ok=True)
markdown_index = annotate_entries_with_stars(remove_sponsors_section(readme_text), stars_data)
sponsorship_md = repo_root / "SPONSORSHIP.md"
sponsorship_md_mtime = datetime.fromtimestamp(sponsorship_md.stat().st_mtime, tz=UTC).date().isoformat()
llms_template = (website / "templates" / "llms.txt").read_text(encoding="utf-8")
@@ -629,7 +627,6 @@ def build(repo_root: Path) -> None:
sitemap_urls.append((subcategory_public_url(cat_slug, sub_slug), sitemap_date))
sitemap_urls.append((SPONSORSHIP_PUBLIC_URL, sponsorship_md_mtime))
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")
print(f"Built site with {len(parsed_groups)} groups, {len(categories)} categories")
+1 -1
View File
@@ -14,7 +14,7 @@
<meta name="description" content="{{ meta_description | trim }}" />
<link rel="canonical" href="{{ canonical_url | trim }}" />
{% block alternate_links %}
<link rel="alternate" type="text/markdown" href="/index.md" />
<link rel="alternate" type="text/plain" href="/llms.txt" title="LLMs text entry point" />
{% endblock %}
<meta property="og:type" content="website" />
<meta property="og:title" content="{{ meta_title | trim }}" />
+1 -2
View File
@@ -2,12 +2,11 @@
Awesome Python is an opinionated catalog of {{ total_entries }} Python frameworks, libraries, tools, and resources across {{ total_categories }} {% if total_categories == 1 %}category{% else %}categories{% endif %}.
Scan the category index, then jump to the matching section for direct project links and short descriptions. GitHub entries with known star data end with a `GitHub stars: N` note in parentheses; treat it as popularity context, not a quality guarantee. Use the Markdown homepage for project context outside the catalog.
Scan the category index, then jump to the matching section for direct project links and short descriptions. GitHub entries with known star data end with a `GitHub stars: N` note in parentheses; treat it as popularity context, not a quality guarantee. Use the homepage for project context outside the catalog.
## Primary Links
- Homepage: {{ site_url }}
- Markdown homepage: {{ index_markdown_url }}
- GitHub repository: {{ github_repo_url }}
- Contributing guide: {{ contributing_url }}
- Sponsorship: {{ sponsorship_url }}
+5 -13
View File
@@ -282,7 +282,7 @@ class TestBuild:
assert parser.meta_by_name["description"] == "Widget libraries. Also see awesome-widgets. Explore 2 curated Python projects in Widgets."
assert parser.links_by_rel["canonical"] == "https://awesome-python.com/categories/widgets/"
assert parser.meta_by_property["og:url"] == "https://awesome-python.com/categories/widgets/"
assert '<link rel="alternate" type="text/markdown" href="/index.md" />' not in category_html
assert '<link rel="alternate" type="text/plain" href="/llms.txt" title="LLMs text entry point" />' not in category_html
assert "<h1>Widgets</h1>" in category_html
assert 'Widget libraries. Also see <a href="https://example.com/widgets" target="_blank" rel="noopener">awesome-widgets</a>.' in category_html
assert 'href="https://example.com/w1"' in category_html
@@ -292,7 +292,7 @@ class TestBuild:
assert "42" in category_html
assert "2026-01-01T00:00:00+00:00" in category_html
def test_build_creates_markdown_alternate_without_sponsors(self, tmp_path):
def test_build_creates_llms_text_alternate_without_sponsors(self, tmp_path):
readme = textwrap.dedent("""\
# Awesome Python
@@ -337,22 +337,15 @@ class TestBuild:
site = tmp_path / "website" / "output"
index_html = (site / "index.html").read_text(encoding="utf-8")
index_md = (site / "index.md").read_text(encoding="utf-8")
llms_txt = (site / "llms.txt").read_text(encoding="utf-8")
assert '<link rel="alternate" type="text/markdown" href="/index.md" />' in index_html
assert index_md.startswith("# Awesome Python\n\nIntro.\n\n# Categories")
assert "# **Sponsors**" not in index_md
assert "Sponsor" not in index_md
assert "SPONSORSHIP.md" not in index_md
assert "## Widgets" in index_md
assert "- [w1](https://example.com) - A widget." in index_md
assert "- [w2](https://github.com/owner/w2) - A starred widget. (42 GitHub stars)" in index_md
assert '<link rel="alternate" type="text/plain" href="/llms.txt" title="LLMs text entry point" />' in index_html
assert llms_txt.startswith("# Awesome Python\n")
assert "Scan the category index" in llms_txt
assert "Homepage: https://awesome-python.com/" in llms_txt
assert "Markdown homepage: https://awesome-python.com/index.md" in llms_txt
assert "Markdown homepage" not in llms_txt
assert "https://awesome-python.com/index.md" not in llms_txt
assert "GitHub repository: https://github.com/vinta/awesome-python" in llms_txt
assert "Contributing guide: https://github.com/vinta/awesome-python/blob/master/CONTRIBUTING.md" in llms_txt
assert "Sponsorship: https://awesome-python.com/sponsorship/" in llms_txt
@@ -364,7 +357,6 @@ class TestBuild:
assert "- [w1](https://example.com) - A widget." in llms_txt
assert "- [w2](https://github.com/owner/w2) - A starred widget. (GitHub stars: 42)" in llms_txt
assert llms_txt != readme
assert llms_txt != index_md
assert "# Contributing" not in llms_txt
def test_build_cleans_stale_output(self, tmp_path):