mirror of
https://github.com/vinta/awesome-python.git
synced 2026-11-20 06:40:51 +00:00
feat(website): show the sponsor band on category pages
The sponsor band rendered only on the homepage, so visitors who entered on a category page and never opened the homepage saw no sponsors. Category, subcategory, group, and Stdlib pages now show the same band between the hero and the table. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
45ad644f1b
commit
786ebb4c78
4 changed files with 35 additions and 1 deletions
|
|
@ -490,6 +490,37 @@ class TestBuild:
|
|||
assert 'href="https://sponsor.example.com/?ref=x&utm_source=awesome-python&utm_content=website"' in index_html
|
||||
assert "utm_content=readme" not in index_html
|
||||
|
||||
def test_category_page_shows_sponsor_band(self, tmp_path):
|
||||
readme = textwrap.dedent("""\
|
||||
# Awesome Python
|
||||
|
||||
Intro.
|
||||
|
||||
## **Sponsors**
|
||||
|
||||
- [Sponsor](https://sponsor.example.com) - Sponsored tool.
|
||||
|
||||
## Projects
|
||||
|
||||
**Tools**
|
||||
|
||||
## Widgets
|
||||
|
||||
- [w1](https://example.com) - A widget.
|
||||
|
||||
# Contributing
|
||||
|
||||
Help!
|
||||
""")
|
||||
(tmp_path / "README.md").write_text(readme, encoding="utf-8")
|
||||
self._copy_real_templates(tmp_path)
|
||||
|
||||
build(tmp_path)
|
||||
|
||||
category_html = (tmp_path / "website" / "output" / "categories" / "widgets" / "index.html").read_text(encoding="utf-8")
|
||||
assert 'href="https://sponsor.example.com"' in category_html
|
||||
assert '<span class="sponsor-name">Sponsor</span>' in category_html
|
||||
|
||||
def test_build_cleans_stale_output(self, tmp_path):
|
||||
readme = textwrap.dedent("""\
|
||||
# T
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue