Give the Routes page one count of authors
Mirror to forge / mirror (push) Canceled after 0s
Validate / validate (push) Canceled after 0s
Validate / history (push) Canceled after 0s
Validate / site (push) Canceled after 0s
Validate / deploy (push) Canceled after 0s

The meta description counted distinct credit lines (43) while the page
counted authors with a page (45). Both now use the number of authors
listed on /authors/, and a test holds them equal.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-17 07:14:31 -07:00
1 parent 298f1b9fd9
commit 51a393ec40
3 files changed
+28 -2

No files matched your search

+5
View File
@@ -1,5 +1,10 @@
# Changelog
## 2026-11-17 - The Routes page gives one count of authors
- The Routes page said "45 authors" on the page and "43 authors" in the description search engines show. The description counted distinct credit lines, so a route credited to two people together counted once; the page counted the authors who have a page. Both now use the number of authors listed on `/authors/`, which is 45, and a test holds the line on the page, the description and the authors page to the same figure.
- No trail's facts changed.
## 2026-11-17 - Every page that shows trails has one layout, and the site sets no tables
- Every page that shows a set of trails now has the same layout: the home page, every place page, every list, the Routes page, the route authors, the Triple Crown, the rankings and the newest trails. Under the page's name and its one line come the trails as rows, with their map beside them on the right. The map stays in view as the rows scroll. This holds from 900 px wide up, so at 1,187 px and at a tablet held sideways the map is beside the trails, not under them. On a narrower screen the map is a short band above the rows, a third of the screen high at most, never below the list.
+3 -2
View File
@@ -214,10 +214,11 @@ def routes_page(records, site, repo_root=None, after="", author_pages=None, n_au
groups = [(f"By {author_pages[a]}" if a in author_pages else f"By {esc(a)}", sorted(by_author[a], key=home.sort_name), route_guides)
for a in sorted(by_author, key=str.lower)]
n_gpx = _gpx_count(routes)
n_authors_said = n_authors or len(by_author) # one figure for the intro, the head and the description
intro = f"""<p>Every other trail on this site is an official trail. Being a route says who looks after it, not
how rough it is: some routes are on maintained trail all the way, and some official trails have
long road walks. The Walking line on each trail&rsquo;s page says what the walking is.</p>
<p>{_plural(len(routes), "route")}, by {n_authors or len(by_author)} authors. {n_gpx} {"has" if n_gpx == 1 else "have"} a GPX here; for the rest,
<p>{_plural(len(routes), "route")}, by {n_authors_said} authors. {n_gpx} {"has" if n_gpx == 1 else "have"} a GPX here; for the rest,
each route&rsquo;s page says whether its author gives the track away, sells it, or does not publish it.
<a href="/?kind=route">Narrow them with the filters</a>.</p>"""
head_count = (f'\n <p class="page-head__lede">{_plural(len(routes), "route")} by <a href="/authors/">{_plural(n_authors, "author")}</a></p>'
@@ -234,7 +235,7 @@ def routes_page(records, site, repo_root=None, after="", author_pages=None, n_au
{after}
<nav class="region-nav" aria-label="Other lists">{'<a href="/authors/">Route authors</a> · ' if linked else ""}<a href="/lists/">All lists</a> · <a href="/">Every trail</a></nav>
</div>"""
description = (f"{_plural(len(routes), 'route')} in the United States and Canada by {len(by_author)} authors, "
description = (f"{_plural(len(routes), 'route')} in the United States and Canada by {n_authors_said} authors, "
f"with their guides{f' and {n_gpx} with a GPX here' if n_gpx else ''}.")
return (browse.by_key("routes").search_title(len(routes)), common.cut_at_word(description, common.DESCRIPTION_LIMIT),
Markup(body), home.has_overview_map(routes))
+20
View File
@@ -68,6 +68,26 @@ class ExtraPagesTest(unittest.TestCase):
self.assertIn(f'href="/trails/{r["id"]}/"', page, r["id"])
self.assertIn(r["route"]["creator"], text, r["id"])
def test_routes_page_author_count_is_the_one_on_the_authors_page(self):
"""The Routes page's visible line, its meta description and its intro say the same number of
authors, and it is the number of authors listed on /authors/ (one page each)."""
import html as _html
from olt import authors
n = len(authors.author_pages(self.records, ROOT))
page = read_out("routes/index.html")
visible = re.search(r'<p class="page-head__lede">\d+ routes? by <a href="/authors/">(\d+) authors?</a>', page)
meta = re.search(r'<meta name="description" content="([^"]*)"', page)
intro = re.search(r"by (\d+) authors\. ", _html.unescape(re.sub(r"<[^>]+>", "", page)))
self.assertTrue(visible and meta and intro)
described = re.search(r"by (\d+) authors", _html.unescape(meta.group(1)))
self.assertEqual(int(visible.group(1)), n)
self.assertEqual(int(described.group(1)), n)
self.assertEqual(int(intro.group(1)), n)
index = read_out("authors/index.html")
self.assertIn(f"worked out by {n} authors", index)
listed = {m for m in re.findall(r'href="(/authors/[^/"]+/)"', index)}
self.assertEqual(len(listed), n)
def test_ways_into_the_authors_pages_are_routes(self):
"""A route's row names its author as a link to their page (each named person who has one);
the Routes page head counts routes and authors and links /authors/; /lists/ lists Route