From 51a393ec40be5e2972c6414a2eb0a23b249f52a4 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Tue, 17 Nov 2026 07:14:31 -0700 Subject: [PATCH] Give the Routes page one count of authors 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 --- CHANGELOG.md | 5 +++++ web/olt/regions.py | 5 +++-- web/tests/test_extra.py | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bfe099..6bfcb5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/web/olt/regions.py b/web/olt/regions.py index 8ac50c6..78d6c80 100644 --- a/web/olt/regions.py +++ b/web/olt/regions.py @@ -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"""

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’s page says what the walking is.

-

{_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, +

{_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’s page says whether its author gives the track away, sells it, or does not publish it. Narrow them with the filters.

""" head_count = (f'\n

{_plural(len(routes), "route")} by {_plural(n_authors, "author")}

' @@ -234,7 +235,7 @@ def routes_page(records, site, repo_root=None, after="", author_pages=None, n_au {after} """ - 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)) diff --git a/web/tests/test_extra.py b/web/tests/test_extra.py index 8844fbb..3908cb9 100644 --- a/web/tests/test_extra.py +++ b/web/tests/test_extra.py @@ -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'

\d+ routes? by (\d+) authors?', page) + meta = re.search(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