From a806522ee18b80bb6be2490b819c998d23683331 Mon Sep 17 00:00:00 2001
From: Stephen Waits
Date: Fri, 20 Nov 2026 13:48:07 -0700
Subject: [PATCH 1/7] Give every page that lists trails the search box and the
filters that have something to offer, however few trails it holds
The cutoff of ten trails is gone, so 48 of the 60 state and province pages, the small lists and each route author's page now have the bar. A set that nothing can narrow gets the search box alone, and an option no trail has is not written. In the state-pages golden file only the hashes of the ten pages that differ changed, each by the added bar and nothing else.
---
web/olt/authors.py | 2 +-
web/olt/home.py | 22 ++++++---------
web/olt/placepages.py | 2 +-
web/olt/regions.py | 3 +--
web/tests/golden/state-pages.json | 20 +++++++-------
web/tests/test_filter_bar.py | 45 ++++++++++++++++++++++---------
6 files changed, 53 insertions(+), 41 deletions(-)
diff --git a/web/olt/authors.py b/web/olt/authors.py
index 0cd2807..b4ec238 100644
--- a/web/olt/authors.py
+++ b/web/olt/authors.py
@@ -312,7 +312,7 @@ def author_page(g, records, site, all_pages):
+ " ยท ".join(f'{esc(x["name"])} ({len(x["routes"])})' for x in nav_items) + "") if nav_items else ""
more = str(summary.facts(routes, records, by_authors=False)) if n >= 3 else ""
briefs = "".join(f'
\n{trail.brief(r)}\n' for r in routes)
- listing = home.results(groups=[(None, routes, regions.route_guides)], routes_list=True, top=2,
+ listing = home.listing(groups=[(None, routes, regions.route_guides)], routes_list=True, top=2,
by=lambda r: with_html(g, r, by_name))
route_title = "About the route" if n == 1 else "About each route"
bio = about_html(g)
diff --git a/web/olt/home.py b/web/olt/home.py
index 6994820..37235f4 100644
--- a/web/olt/home.py
+++ b/web/olt/home.py
@@ -239,17 +239,13 @@ def entry(rec, *, level=3, extra="", routes_list=False, hidden=False, eager=Fals
# The filters ------------------------------------------------------------------
-# One bar and one set of panels, on the home page and on every other page that shows a set of at
-# least FILTER_MIN trails (listing()), and on every park, range and wilderness page whatever its
-# size (the owner's rule: every set of trails gets the bar). Everything is built from the page's own trails: a facet that
+# One bar and one set of panels, on the home page and on every other page that shows a set of
+# trails (listing()), whatever its size (the owner's rule: every set of trails gets the bar). Everything is built from the page's own trails: a facet that
# cannot narrow them is left out, and an option none of them has is not written. The numbers written
# here are for the whole set; app.js counts again from the rows on the page every time anything
# changes, and hides an option that would show nothing (its counting is facetCounts(), which
# web/tests/test_filter_counts.py runs under node against counts made here from the records).
-FILTER_MIN = 10
-
-
def _length_options(steps, selected_any_last, unit="mi"):
opts = [f'' for n in steps]
if selected_any_last:
@@ -443,15 +439,13 @@ def finder_form(records, c=None, steps=None, where="all", bare_if_empty=False):
"""
-def listing(recs=None, *, where="all", groups=None, always=False, **kw):
- """The rows of a page that shows a set of trails, with the filter bar over them when the set
- has at least FILTER_MIN trails (else results() alone); with always, whatever its size (the
- bar then holds only the filters that have something to offer). where: the Where filter's
- scope (finder_form). The other arguments are results()'s."""
+def listing(recs=None, *, where="all", groups=None, **kw):
+ """The rows of a page that shows a set of trails, with the filter bar over them whatever the size
+ of the set (the bar holds only the filters that have something to offer, and the search box
+ alone where nothing can narrow the set). where: the Where filter's scope (finder_form). The
+ other arguments are results()'s."""
trails = [r for g in groups for r in g[1]] if groups is not None else list(recs)
- if len(trails) < FILTER_MIN and not always:
- return results(recs, groups=groups, **kw)
- return Markup(f"""
- {home.browse_view(home.listing(recs, top=2, where=kind.where, wholly=wholly, always=kind.always_filters), home.overview_map(recs, f"Map of the trails {phrase}", place=kind.box(info)),
+ {home.browse_view(home.listing(recs, top=2, where=kind.where, wholly=wholly), home.overview_map(recs, f"Map of the trails {phrase}", place=kind.box(info)),
about=f"{summary.facts(recs, records, place=place)}{summary.details(recs)}",
about_title=f"About the trails {phrase}")}
{nav}{place_links}
diff --git a/web/tests/golden/state-pages.json b/web/tests/golden/state-pages.json
index 1863e2c..6d57e57 100644
--- a/web/tests/golden/state-pages.json
+++ b/web/tests/golden/state-pages.json
@@ -1,14 +1,14 @@
{
"/regions/": "e70a9608ef0ee6a97d0591ad582abff1b165371dee5111e3277df06a53a554e1",
- "/regions/atlantic-canada/": "6af5c4a79cac82eb0a4342297fd4f6755890e98597a98f219087c56432f06243",
- "/regions/ca-on/": "12b5726d800090233f082a572cf1472f152552cef8fa5019f49b83e32e337eef",
- "/regions/central-canada/": "fa6f8bbe466b5978f1edda22371b6aab8546efa567eee0d0405c717e278b8a3e",
- "/regions/mountain-west/": "c079eb93a55c2279f24083983230057940eb032cb034057c822c52230ce22e05",
- "/regions/north/": "fdfd201ae1e42b8fd17dd055815d4b06392a8ddb6ac3e72a06f15ec2b333fb56",
- "/regions/us-co/": "45cb1b92fd22ffc35f82a26fe2c71b66836b0624bf0e195f9c4926dfab6a8900",
- "/regions/us-co/loops/": "8883c9aac63f100196f9e853d6738a42b8199f1250c10ec34d1d0cfe8c998e7d",
- "/regions/us-co/with-gpx/": "abc3f7e44cbcbf8d6cce3b5d5065e6e7c085ec5a4033842af8909077f87e1e18",
+ "/regions/atlantic-canada/": "5146b4b9d1940a268cfd2345f1eee2263fd6c7e2dfd28adfdffc3fff0e698c93",
+ "/regions/ca-on/": "d4e543c6f163ba188a34444b42c494a3dbbd26c02f2b141339bbc230cd91f84e",
+ "/regions/central-canada/": "d7478ad682d715705770d35cc902c80c40d27719e7f9f5a1d99ec702d3f7a43e",
+ "/regions/mountain-west/": "6151f5a28d366fb48aab7027f08cea6da425201d0e7327780a01dd77cedc7bc7",
+ "/regions/north/": "85ba3ea850c2df690e311cf09257f2548ed888c07c319a01fd30d5e19cdf1fd4",
+ "/regions/us-co/": "97daaf3511578896b222570cba630da2d8ca0571504ce43b3685dbe532e40f56",
+ "/regions/us-co/loops/": "03896834b5369655f7b5f26634b6d23c834b17f1a25b0ec328d44934e20e2dfa",
+ "/regions/us-co/with-gpx/": "d82eace3d70eb9b1ef1346f5a3470199bd6a00e6e104fe661bfeb80199af96b8",
"/regions/us-hi/": "1e5681ffbd50e382db7d69528fde602069006bf0cddad494d817369224bd96ad",
- "/regions/us-ut/": "065bcc01e14eb588dc1b118c466f44474fca0172c30037fb193d83a044624100",
- "/regions/western-canada/": "91b40d35dd3d1a093d38d01bbfcf1ef536221a69631fc58e46732da81d0582c3"
+ "/regions/us-ut/": "906db4153def35fa5418d0b86dba908fd27396bbc2098978ee169516e1b39785",
+ "/regions/western-canada/": "1b102ed9d47283869fdf8c8d54229d245f2113fd53c7e8ec2ecc118fd4da3b64"
}
diff --git a/web/tests/test_filter_bar.py b/web/tests/test_filter_bar.py
index 84e9fb1..1911f9a 100644
--- a/web/tests/test_filter_bar.py
+++ b/web/tests/test_filter_bar.py
@@ -1,7 +1,7 @@
"""The filter bar on every page that shows a set of trails, and the numbers beside its choices.
The bar (olt/home.py listing(), finder_form()) is the home page's, on each list, place and the Routes
-page whose set has at least home.FILTER_MIN trails, built from that page's own trails. app.js counts
+page, whatever the number of trails, built from that page's own trails. app.js counts
the choices again from the rows on the page every time anything changes (FacetCount, between the
facet-counts markers); this file runs that counting under node, on the rows the home page writes,
and checks it against counts made here straight from the records. Pages are rendered one at a time;
@@ -68,22 +68,36 @@ class WhichPagesHaveTheBarTest(unittest.TestCase):
lst = browse.by_key(key)
return regions.list_page(lst, self.shown[key], len(self.records), SITE, records=self.records)[2]
- def test_a_list_page_a_place_page_a_part_of_the_country_and_routes_have_it(self):
- self.assertGreaterEqual(len(self.shown["loops"]), home.FILTER_MIN)
- self.assertTrue(form_of(self.list_body("loops")))
+ def test_a_list_page_a_place_page_a_part_of_the_country_and_routes_have_it(self):
+ self.assertTrue(form_of(self.list_body("loops")))
by_slug, _ = regions.collect_regions(self.records)
- self.assertGreaterEqual(len(by_slug["ca-on"]["records"]), home.FILTER_MIN)
self.assertTrue(form_of(regions.region_page("ca-on", self.records, SITE)[2]))
self.assertTrue(form_of(regions.group_page("central-canada", self.records, SITE)[2]))
self.assertTrue(form_of(regions.routes_page(self.records, SITE)[2]))
- def test_a_set_under_the_threshold_has_the_plain_rows(self):
- small = [k for k, recs in self.shown.items() if len(recs) < home.FILTER_MIN and k != "routes"]
- self.assertTrue(small)
+ def test_every_state_province_and_list_page_has_the_bar_however_few_trails(self):
+ by_slug, _ = regions.collect_regions(self.records)
+ small = [k for k, v in by_slug.items() if len(v["records"]) < 10]
+ self.assertGreater(len(small), 40)
for key in small:
- body = self.list_body(key)
- self.assertFalse(form_of(body), key)
- self.assertNotIn("data-finder", str(body), key)
+ body = regions.region_page(key, self.records, SITE)[2]
+ self.assertIn('id="finder-form"', str(body), key)
+ self.assertIn("data-finder", str(body), key)
+ small_lists = [k for k, recs in self.shown.items() if len(recs) < 10 and k != "routes"]
+ self.assertTrue(small_lists)
+ for key in small_lists:
+ self.assertTrue(form_of(self.list_body(key)), key)
+
+ def test_a_two_trail_page_offers_only_filters_that_narrow_it(self):
+ by_slug, _ = regions.collect_regions(self.records)
+ two = [k for k, v in by_slug.items() if len(v["records"]) == 2]
+ self.assertTrue(two)
+ for key in two:
+ form = form_of(regions.region_page(key, self.records, SITE)[2])
+ self.assertIn('name="q"', form, key)
+ for sel in re.findall(r"", form, re.S):
+ self.assertNotIn("", sel)
+ self.assertGreater(len(re.findall(r"
', body, re.S).group(1)
+ self.assertEqual(
+ re.sub(r"<[^>]+>", "", line),
+ "Browse by park, by mountain range or by wilderness area.")
+ for frag in ('href="/regions/#parks">park', 'href="/regions/#ranges">mountain range',
+ 'href="/regions/#wilderness">wilderness area'):
+ self.assertIn(frag, line)
+ # after the rows and the map, in the notes at the foot, never in the intro
+ self.assertGreater(body.index("finder__places"), body.rindex('
"), body.index("finder__places"))
+
+ def test_only_the_kinds_with_pages_and_none_when_there_are_none(self):
+ line = re.search(r'finder__places">(.*?)
', str(home.render(self.records, S, ROOT, place_kinds=["range"])), re.S).group(1)
+ self.assertEqual(re.sub(r"<[^>]+>", "", line), "Browse by mountain range.")
+ self.assertNotIn("finder__places", str(home.render(self.records, S, ROOT)))
+
+
class HubTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
From 742f5da4f11d20a39e3817d9e3e613ac2cf88722 Mon Sep 17 00:00:00 2001
From: Stephen Waits
Date: Fri, 20 Nov 2026 13:51:50 -0700
Subject: [PATCH 4/7] Say in the changelog what the filter bar and the new ways
in to the place pages change for a visitor
---
CHANGELOG.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2adc7fe..122cb64 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog
+## 2026-11-20 - The search box and filters on every page, and ways in to the places
+
+- Every page that lists trails now has the search box and the filters, however few trails it holds. Until now the 48 state and province pages with fewer than ten trails, the small lists and each route author's page showed the rows alone. The filters shown are the ones that have something to offer: a page with two trails offers the choices those two trails differ on, with the number that each choice leaves, and a page with one trail has the search box alone. Nothing is offered that would show no trails.
+- The Places page now begins with one row of links, visible at every screen size: States and provinces, Parks, Mountain ranges and Wilderness areas, each with its number of pages. They go to the parts of the page that were at the bottom, below sixty states and provinces.
+- The home page ends with a line under the rows and the map: Browse by park, by mountain range or by wilderness area, each going to its part of the Places page. The first screen is as it was.
+
## 2026-11-20 - Pages for national parks, mountain ranges and wilderness areas
- There are now 81 pages for named places: 21 national parks and other Park Service units (such as the Blue Ridge Parkway and Glen Canyon National Recreation Area), 36 mountain ranges and other named landforms (the Colorado Plateau and the Mogollon Rim are labelled and worded as what they are, "on the Colorado Plateau") and 24 wilderness areas, each with 3 or more trails. Every page has the search box and the filters that have something to offer, however few trails it holds, and every title keeps its count of trails. They answer searches such as "Wind River Range hikes" or "backpacking in Glacier National Park", and each has the same filter bar, trail rows and map as a state page. A place with fewer than 3 trails has no page: the Uinta Mountains have one. A range or wilderness area that holds exactly the trails of the park of the same name (Great Smoky Mountains, Olympic Mountains) has no page of its own either, and six places that were only another name for trails already on a neighbour's page are left out: the Longfellow Mountains, Finger Lakes, Gore Range, Mosquito Range, Great Western Divide and Russian Wilderness.
From f669a6695a41ff2b6c9dcf0f092d40abbe6f9455 Mon Sep 17 00:00:00 2001
From: Stephen Waits
Date: Fri, 20 Nov 2026 13:54:27 -0700
Subject: [PATCH 5/7] Mark the places checklist's sub-steps with asterisks so
the audit document keeps the house wording the seasons check reads
---
docs/audit.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/audit.md b/docs/audit.md
index e027715..aac36f3 100644
--- a/docs/audit.md
+++ b/docs/audit.md
@@ -17,11 +17,11 @@ down the list in order and stop at the first step that fails.
`python3 -m unittest discover -s web/tests` must both pass.
6. **Check the places.** `python3 tools/place_trails.py --check --refresh` downloads every outline again (without `--refresh` it reuses the files already in the cache, which are the ones first downloaded),
measures every track again and prints each difference from the records, one per line:
- - a place gained or lost by a trail: re-run `place_trails.py propose`, read the line, and
+ * a place gained or lost by a trail: re-run `place_trails.py propose`, read the line, and
apply it only when the new outline is right;
- - a boundary that moved (a new source version): the owner rules whether the new outline
+ * a boundary that moved (a new source version): the owner rules whether the new outline
replaces the old one;
- - a place that crossed the 3-trail line: its page appears or goes, so check its links and the
+ * a place that crossed the 3-trail line: its page appears or goes, so check its links and the
counts that name it.
The monthly workflow `.github/workflows/places.yml` runs this step by itself and fails with
the list; this step is the one you run when it has failed, and before a release.
From fc66f541a30943762863cb27a618eaa7a3627391 Mon Sep 17 00:00:00 2001
From: Stephen Waits
Date: Fri, 20 Nov 2026 14:08:34 -0700
Subject: [PATCH 6/7] Let a set with no trails build its filter bar, and pin
the Places page's new jump-link anchor in the state-pages golden file
In the golden file only the hash of /regions/ changed, by the anchor the jump row's first link goes to.
---
web/olt/home.py | 2 +-
web/tests/golden/state-pages.json | 2 +-
web/tests/test_filter_bar.py | 3 +++
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/web/olt/home.py b/web/olt/home.py
index 876a298..9b6ff48 100644
--- a/web/olt/home.py
+++ b/web/olt/home.py
@@ -336,7 +336,7 @@ def finder_form(records, c=None, steps=None, where="all", bare_if_empty=False):
""")
- kms = [r["length_km"] for r in records]
+ kms = [r["length_km"] for r in records] or [0]
if any(min(kms) < n * words.KM_PER_MI <= max(kms) for n in steps):
first.append(f"""