From 6c6251a6006018792368f733694f71b90fcc5e04 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Mon, 23 Nov 2026 16:06:01 -0700 Subject: [PATCH] Give a single day figure as one figure, not as a range, in the data for search engines Co-Authored-By: Claude Fable 5.2 --- CHANGELOG.md | 4 ++++ web/olt/seo.py | 8 ++++++-- web/tests/test_length_facts.py | 10 ++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33f683a..b6d6b8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2026-11-23 - A single day figure is no longer written as a range + +- The data each trail page gives to search engines wrote a trail with one stated time as a range, for example "7 to 7 days". It now gives the one figure, 7 days. A range is still written as a range, such as 5 to 8 days. The page a visitor reads already said it correctly. + ## 2026-11-23 - A clearer rule for trails under 50 miles, 18 more entries on the left-out page, and the Vallecito Reservoir Loop added - The rule for a trail under 50 miles (80 km) is stated more plainly. It is listed only when it is still reasonably long and at least one of three things is true: it has real cross-country travel; it genuinely takes a fit, experienced party five or more days because the ground is hard; or it is very well known and popular, as the Rae Lakes Loop is. The five-day reason is about the ground: there is no trail, or the going is rough or unmaintained and needs route finding, with fords or thick brush. The number of days a managing body, an author or a guidebook prints does not decide it, and a walk on ordinary built trail spread over five or more days at an easy pace does not count. Being close to 50 miles is never a reason. The rule is in the "Inclusion rule" section of README.md, in CONTRIBUTING.md and in docs/schema.md. diff --git a/web/olt/seo.py b/web/olt/seo.py index e9c6b88..e9adf71 100644 --- a/web/olt/seo.py +++ b/web/olt/seo.py @@ -277,8 +277,12 @@ def _properties(rec): props.append(_pv("Built length", rec["built_km"], "KMT", "kilometres")) days = h.get("days") if isinstance(days, list) and len(days) == 2: - props.append(_pv("Usual time to walk it all", f"{days[0]} to {days[1]} days", "DAY", "days", - minValue=days[0], maxValue=days[1])) + lo, hi = min(days), max(days) + if lo == hi: # one figure, not a range: "7 days", never "7 to 7 days" + props.append(_pv("Usual time to walk it all", lo, "DAY", "day" if lo == 1 else "days")) + else: + props.append(_pv("Usual time to walk it all", f"{lo} to {hi} days", "DAY", "days", + minValue=lo, maxValue=hi)) elif isinstance(days, int): props.append(_pv("Usual time to walk it all", days, "DAY", "days")) if h.get("high_point_m"): diff --git a/web/tests/test_length_facts.py b/web/tests/test_length_facts.py index e5b0544..f634f98 100644 --- a/web/tests/test_length_facts.py +++ b/web/tests/test_length_facts.py @@ -103,6 +103,16 @@ class StructuredDataTest(unittest.TestCase): def props(self, rec): return {(p["name"], p.get("unitCode")): p for p in seo.place_node(rec, GH)["additionalProperty"]} + def test_one_day_figure_is_never_written_as_a_range(self): + rec = florida() + rec["hike"] = dict(rec.get("hike") or {}, days=[7, 7]) + one = self.props(rec)[("Usual time to walk it all", "DAY")] + self.assertEqual(one["value"], 7) + self.assertNotIn("minValue", one) + rec["hike"]["days"] = [5, 8] + span = self.props(rec)[("Usual time to walk it all", "DAY")] + self.assertEqual((span["value"], span["minValue"], span["maxValue"]), ("5 to 8 days", 5, 8)) + def test_the_length_stays_canonical_and_the_system_figure_is_labelled(self): props = self.props(florida()) self.assertEqual(props[("Published length", "KMT")]["value"], 1818)