Skip to content

Commit 438f648

Browse files
authored
Surface sponsors on welcome page and sidebar (#2921)
1 parent 10ddc6d commit 438f648

8 files changed

Lines changed: 124 additions & 185 deletions

File tree

docs/css/extra.css

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
.md-nav__sponsors {
2+
display: flex;
3+
flex-direction: column;
4+
align-items: center;
5+
gap: 0.5rem;
6+
margin: 1.2rem 0.4rem 0.6rem;
7+
padding: 0.9rem 0.6rem 0.8rem;
8+
background-color: color-mix(in srgb, var(--md-primary-fg-color) 8%, transparent);
9+
border-radius: 0.4rem;
10+
}
11+
12+
.md-nav__sponsors-title {
13+
margin: 0 0 0.1rem;
14+
font-size: 0.6rem;
15+
font-weight: 700;
16+
text-transform: uppercase;
17+
letter-spacing: 0.05em;
18+
color: var(--md-default-fg-color--light);
19+
}
20+
21+
.md-nav__sponsor {
22+
display: flex;
23+
align-items: center;
24+
justify-content: center;
25+
width: 100%;
26+
padding: 0.25rem;
27+
border-radius: 0.2rem;
28+
transition: opacity 0.15s;
29+
}
30+
31+
.md-nav__sponsor:hover {
32+
opacity: 0.75;
33+
}
34+
35+
.md-nav__sponsor img {
36+
max-width: 100%;
37+
max-height: 1.6rem;
38+
object-fit: contain;
39+
}
40+
41+
img[src*="#only-dark"],
42+
img[src*="#gh-dark-mode-only"] {
43+
display: none;
44+
}
45+
46+
[data-md-color-scheme="slate"] img[src*="#only-dark"],
47+
[data-md-color-scheme="slate"] img[src*="#gh-dark-mode-only"] {
48+
display: inline;
49+
}
50+
51+
[data-md-color-scheme="slate"] img[src*="#only-light"],
52+
[data-md-color-scheme="slate"] img[src*="#gh-light-mode-only"] {
53+
display: none;
54+
}
55+
56+
.md-nav__sponsor-cta {
57+
display: inline-block;
58+
margin-top: 0.15rem;
59+
padding: 0.25rem 0.6rem;
60+
font-size: 0.65rem;
61+
font-weight: 600;
62+
color: var(--md-primary-bg-color);
63+
background-color: var(--md-primary-fg-color);
64+
border-radius: 0.2rem;
65+
text-decoration: none;
66+
transition: opacity 0.15s;
67+
}
68+
69+
.md-nav__sponsor-cta:hover {
70+
opacity: 0.85;
71+
color: var(--md-primary-bg-color);
72+
}

docs/img/fastapi-logo.png

19.4 KB
Loading

docs/img/hf-logo-with-title-dark.svg

Lines changed: 9 additions & 0 deletions
Loading

docs/img/hf-logo-with-title.svg

Lines changed: 9 additions & 0 deletions
Loading

docs/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ and means we're now able to start building a common set of tooling usable across
4444

4545
Uvicorn currently supports **HTTP/1.1** and **WebSockets**.
4646

47+
## Sponsorship
48+
49+
Help us keep Uvicorn maintained and sustainable by [becoming a sponsor](https://github.com/sponsors/Kludex).
50+
51+
**Current sponsors:**
52+
53+
<div style="display: flex; flex-wrap: wrap; gap: 2rem; align-items: center; margin: 1rem 0;">
54+
<a href="https://fastapi.tiangolo.com">
55+
<img src="img/fastapi-logo.png" alt="FastAPI" style="height: 80px;">
56+
</a>
57+
<a href="https://huggingface.co">
58+
<img src="img/hf-logo-with-title.svg#only-light" alt="Hugging Face" style="height: 80px;">
59+
<img src="img/hf-logo-with-title-dark.svg#only-dark" alt="Hugging Face" style="height: 80px;">
60+
</a>
61+
</div>
62+
4763
## Quickstart
4864

4965
**Uvicorn** is available on [PyPI](https://pypi.org/project/uvicorn/) so installation is as simple as:

docs/overrides/partials/nav.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,19 @@
4444
{{ item.render(nav_item, path, 1) }}
4545
{% endfor %}
4646
</ul>
47+
48+
<!-- Sponsors -->
49+
<div class="md-nav__sponsors">
50+
<p class="md-nav__sponsors-title">Sponsors</p>
51+
<a href="https://fastapi.tiangolo.com" title="FastAPI" class="md-nav__sponsor">
52+
<img src="{{ 'img/fastapi-logo.png' | url }}" alt="FastAPI">
53+
</a>
54+
<a href="https://huggingface.co" title="Hugging Face" class="md-nav__sponsor">
55+
<img src="{{ 'img/hf-logo-with-title.svg' | url }}#only-light" alt="Hugging Face">
56+
<img src="{{ 'img/hf-logo-with-title-dark.svg' | url }}#only-dark" alt="Hugging Face">
57+
</a>
58+
<a href="https://github.com/sponsors/Kludex" class="md-nav__sponsor-cta">
59+
Become a sponsor! ❤️
60+
</a>
61+
</div>
4762
</nav>

docs/sponsorship.md

Lines changed: 0 additions & 184 deletions
This file was deleted.

mkdocs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ nav:
6262
- Docker: deployment/docker.md
6363
- Release Notes: release-notes.md
6464
- Contributing: contributing.md
65-
- Sponsorship: sponsorship.md
6665

6766
extra:
6867
analytics:
@@ -80,6 +79,9 @@ extra:
8079
- icon: fontawesome/solid/globe
8180
link: https://fastapiexpert.com
8281

82+
extra_css:
83+
- css/extra.css
84+
8385
markdown_extensions:
8486
- attr_list
8587
- admonition

0 commit comments

Comments
 (0)