diff --git a/website/static/style.css b/website/static/style.css
index 12c86ba4..f8eca400 100644
--- a/website/static/style.css
+++ b/website/static/style.css
@@ -1905,7 +1905,10 @@ th[data-sort].sort-asc::after {
}
.col-num,
- .col-cat {
+ .col-cat,
+ .group-count,
+ /* Leaves the arrow column as narrow as the row arrows */
+ .back-to-top-label {
display: none;
}
@@ -1947,6 +1950,7 @@ th[data-sort].sort-asc::after {
.col-arrow {
width: 1.8rem;
+ text-align: right;
}
}
diff --git a/website/templates/_category_nav.html b/website/templates/_category_nav.html
new file mode 100644
index 00000000..c6f60bd6
--- /dev/null
+++ b/website/templates/_category_nav.html
@@ -0,0 +1,22 @@
+
+
+
+ Browse by category
+
+
+
+
+
diff --git a/website/templates/_entry_rows.html b/website/templates/_entry_rows.html
new file mode 100644
index 00000000..5629aff2
--- /dev/null
+++ b/website/templates/_entry_rows.html
@@ -0,0 +1,133 @@
+{% macro entry_rows(entry, index, home=false) %}
+ {# On section and subcategory pages the group heading already names the row's use case #}
+ {% set grouped_page = entry_groups and not group_categories %}
+ {% set section_path = "/categories/" ~ parent_category.slug ~ "/" if parent_category else current_path %}
+
+ {{ index }}
+
+ {{ entry.name }}
+ {% if entry.subcategories %}{{ entry.subcategories[0].name }}{%
+ else %}{{ entry.categories[0] if home else category.name }}{% endif %}
+
+
+ {% if entry.downloads is not none %}{{
+ "{:,}".format(entry.downloads) }}{% elif entry.source_type ==
+ 'Stdlib' %}Stdlib {% elif
+ entry.bundled %}Bundled {% elif
+ entry.badge %}{{ entry.badge }} {%
+ else %}Not on PyPI {% endif %}
+
+
+ {% if entry.stars is not none %}{{ "{:,}".format(entry.stars) }}{%
+ elif entry.source_type %}{{ entry.source_type }} {% else %}—{% endif %}
+
+
+ {% if entry.last_commit_at %}{{ entry.last_commit_at[:10] }} {% else %}—{% endif %}
+
+
+ {% for subcat in entry.subcategories %}
+
+ {{ subcat.name }}
+
+ {% endfor %}
+ {% for cat in entry.categories %}
+ {{ cat }}
+ {% endfor %}
+ {% if entry.groups %}
+ {% set group_url = filter_urls[entry.groups[0]] %}
+
+ {{ entry.groups[0] }}
+
+ {% endif %}
+ {% if entry.source_type == 'Stdlib' %}
+
+ Stdlib
+
+ {% endif %}
+
+ →
+
+ {% if entry.description %}
+
+
+
+ {{ entry.description | safe }}
+
+
+ {% endif %}
+
+
+
+
+ {% if entry.also_see %}
+
+ Also see: {% for see in entry.also_see %}
{{ see.name }} {% if not loop.last %}, {% endif %}{% endfor %}
+
+ {% endif %}
+
+
+
+
+
+{% endmacro %}
diff --git a/website/templates/_final_cta.html b/website/templates/_final_cta.html
new file mode 100644
index 00000000..95c7c58b
--- /dev/null
+++ b/website/templates/_final_cta.html
@@ -0,0 +1,23 @@
+
+
+
Contribute
+
Know a project that belongs here?
+
Tell us what it does and why it stands out.
+
+
+
diff --git a/website/templates/_projects_table.html b/website/templates/_projects_table.html
new file mode 100644
index 00000000..0152e5ec
--- /dev/null
+++ b/website/templates/_projects_table.html
@@ -0,0 +1,74 @@
+{% macro projects_table(count, scope, editorial=false) %}
+
+
Search and filter
+
+
+
+
+
+
+
+
+
+ Results
+
+
+
+
+ Row number
+
+ Project Name
+
+
+ PyPI Downloads
+
+
+ GitHub Stars
+
+
+ Last Commit
+
+ Tags
+
+
+ Top ↑
+
+
+
+
+
+{{ caller() }}
+
+
+
+
+
+
No projects match your search.
+
+ Try a broader term, or
+ browse all projects .
+
+
+{% endmacro %}
diff --git a/website/templates/_topbar.html b/website/templates/_topbar.html
new file mode 100644
index 00000000..0fcde817
--- /dev/null
+++ b/website/templates/_topbar.html
@@ -0,0 +1,20 @@
+
+ {% if home %}
+ Awesome Python
+ {% else %}
+ Awesome Python
+ {% endif %}
+
+
diff --git a/website/templates/category.html b/website/templates/category.html
index 4399505c..4ec943e8 100644
--- a/website/templates/category.html
+++ b/website/templates/category.html
@@ -1,4 +1,6 @@
{% extends "base.html" %}
+{% from "_projects_table.html" import projects_table %}
+{% from "_entry_rows.html" import entry_rows with context %}
{% block title %}{{ category_title }}{% endblock %}
{% block description %}{{ category_description }}{% endblock %}
{% block canonical_url %}{{ category_url }}{% endblock %}
@@ -11,20 +13,7 @@
-
- Awesome Python
-
-
+ {%+ with all_projects = true %}{% include "_topbar.html" %}{% endwith +%}
{% if parent_category %}
@@ -55,158 +44,12 @@
{% if group_categories %}
-
-
-
Browse by category
-
-
- {% for sub in group_categories %}
-
- {{ sub.name }}
-
- {% endfor %}
-
-
+ {%+ with nav_categories = group_categories %}{% include "_category_nav.html" %}{% endwith +%}
{% endif %}
{% endblock %}
{% block content %}
-{% macro entry_rows(entry, index) %}
- {# On section and subcategory pages the group heading already names the row's use case #}
- {% set grouped_page = entry_groups and not group_categories %}
- {% set section_path = "/categories/" ~ parent_category.slug ~ "/" if parent_category else current_path %}
-
- {{ index }}
-
- {{ entry.name }}
- {% if entry.subcategories %}{{ entry.subcategories[0].name }}{%
- else %}{{ category.name }}{% endif %}
-
-
- {% if entry.downloads is not none %}{{
- "{:,}".format(entry.downloads) }}{% elif entry.source_type ==
- 'Stdlib' %}Stdlib {% elif
- entry.bundled %}Bundled {% elif
- entry.badge %}{{ entry.badge }} {%
- else %}Not on PyPI {% endif %}
-
-
- {% if entry.stars is not none %}{{ "{:,}".format(entry.stars) }}{%
- elif entry.source_type %}{{ entry.source_type }} {% else %}—{% endif %}
-
-
- {% if entry.last_commit_at %}{{ entry.last_commit_at[:10] }} {% else %}—{% endif %}
-
-
- {% for subcat in entry.subcategories %}
-
- {{ subcat.name }}
-
- {% endfor %}
- {% for cat in entry.categories %}
- {{ cat }}
- {% endfor %}
- {% if entry.groups %}
- {% set group_url = filter_urls[entry.groups[0]] %}
-
- {{ entry.groups[0] }}
-
- {% endif %}
- {% if entry.source_type == 'Stdlib' %}
-
- Stdlib
-
- {% endif %}
-
- →
-
- {% if entry.description %}
-
-
-
- {{ entry.description | safe }}
-
-
- {% endif %}
-
-
-
-
- {% if entry.also_see %}
-
- Also see: {% for see in entry.also_see %}
{{ see.name }} {% if not loop.last %}, {% endif %}{% endfor %}
-
- {% endif %}
-
-
-
-
-
-{% endmacro %}
{% include "_sponsor_band.html" %}
@@ -229,66 +72,7 @@
-
-
Search and filter
-
-
-
-
-
-
-
-
-
- Results
-
-
-
-
- Row number
-
- Project Name
-
-
- PyPI Downloads
-
-
- GitHub Stars
-
-
- Last Commit
-
- Tags
-
-
- Top ↑
-
-
-
-
-
+ {% call projects_table(entries | length, "in " ~ category.name, entry_groups) %}
{% if entry_groups %}
{% set row = namespace(index=0) %}
{% for group in entry_groups %}
@@ -315,17 +99,7 @@
{{ entry_rows(entry, loop.index) }}
{% endfor %}
{% endif %}
-
-
-
-
-
-
No projects match your search.
-
- Try a broader term, or
- browse all projects .
-
-
+ {% endcall %}
{% if guide_html %}
@@ -337,27 +111,5 @@
{% endif %}
-
-
-
Contribute
-
Know a project that belongs here?
-
Tell us what it does and why it stands out.
-
-
-
+{% include "_final_cta.html" +%}
{% endblock %}
diff --git a/website/templates/index.html b/website/templates/index.html
index fcea908b..165e77d3 100644
--- a/website/templates/index.html
+++ b/website/templates/index.html
@@ -1,4 +1,6 @@
{% extends "base.html" %}
+{% from "_projects_table.html" import projects_table %}
+{% from "_entry_rows.html" import entry_rows with context %}
{% block extra_head %}
{% endblock %}
@@ -7,19 +9,7 @@
-
- Awesome Python
-
-
+ {%+ with home = true %}{% include "_topbar.html" %}{% endwith +%}
-
-
-
- Browse by category
-
-
-
-
-
+ {%+ with nav_categories = categories %}{% include "_category_nav.html" %}{% endwith +%}
{% endblock %}
@@ -89,225 +58,12 @@
-
-
Search and filter
-
-
-
-
-
-
-
-
-
- Results
-
-
-
-
- Row number
-
- Project Name
-
-
- PyPI Downloads
-
-
- GitHub Stars
-
-
- Last Commit
-
- Tags
-
-
- Top ↑
-
-
-
-
-
+ {% call projects_table(entries | length, "across " ~ total_categories ~ " categories") %}
{% for entry in entries %}
-
- {{ loop.index }}
-
- {{ entry.name }}
- {% if entry.subcategories %}{{ entry.subcategories[0].name }}{%
- else %}{{ entry.categories[0] }}{% endif %}
-
-
- {% if entry.downloads is not none %}{{
- "{:,}".format(entry.downloads) }}{% elif entry.source_type ==
- 'Stdlib' %}Stdlib {% elif
- entry.bundled %}Bundled {% elif
- entry.badge %}{{ entry.badge }} {%
- else %}Not on PyPI {% endif %}
-
-
- {% if entry.stars is not none %}{{ "{:,}".format(entry.stars) }}{%
- elif entry.source_type %}{{ entry.source_type }} {% else %}—{% endif %}
-
-
- {% if entry.last_commit_at %}{{ entry.last_commit_at[:10] }} {% else %}—{% endif %}
-
-
- {% for subcat in entry.subcategories %}
-
- {{ subcat.name }}
-
- {% endfor %} {% for cat in entry.categories %}
- {{ cat }}
- {% endfor %}
-
- {{ entry.groups[0] }}
-
- {% if entry.source_type == 'Stdlib' %}
-
- Stdlib
-
- {% endif %}
-
- →
-
- {% if entry.description %}
-
-
-
- {{ entry.description | safe }}
-
-
- {% endif %}
-
-
-
-
- {% if entry.also_see %}
-
- Also see: {% for see in entry.also_see %}
{{ see.name }} {% if not loop.last %}, {% endif %}{% endfor %}
-
- {% endif %}
-
-
-
-
-
+ {{ entry_rows(entry, loop.index, home=true) }}
{% endfor %}
-
-
-
-
-
-
No projects match your search.
-
- Try a broader term, or
- browse all projects .
-
-
+ {% endcall %}
-
-
-
Contribute
-
Know a project that belongs here?
-
Tell us what it does and why it stands out.
-
-
-
+{% include "_final_cta.html" +%}
{% endblock %}
diff --git a/website/templates/sponsorship.html b/website/templates/sponsorship.html
index 72c5bc2d..cafbfda1 100644
--- a/website/templates/sponsorship.html
+++ b/website/templates/sponsorship.html
@@ -11,19 +11,7 @@