Say what each page is in the words people search with, and mark up the facts
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

A whole-site search audit found clean foundations and three gaps: titles
without the words people search for, no structured data on trail pages,
and trails that did not link to each other.

- Trail titles carry the name hikers use, the abbreviation, the length
  and what the page offers; "GPX" only where the page has one. A new
  optional `common_name` field holds the name hikers use (13 records).
- Descriptions are built from each record, at most 155 characters.
- Place and list pages are titled for what they are; heading levels no
  longer jump.
- Trail pages link to similar and related trails and to the lists they
  belong to. Every trail has at least three links from other trails.
- JSON-LD on every page: a Place for each trail, breadcrumbs, item lists
  on list and place pages, WebSite and Organization on the home page, a
  fuller Dataset on the data page.
- A social card per trail, a changelog feed, `lastmod` in the sitemap from
  record dates, `noindex` on the 404 and on raw per-trail files, a
  favicon and an `llms.txt` listing the data files and licences.
- The "Considered and left out" page has its spacing fixed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-16 14:57:30 -07:00
1 parent a46338afd5
commit 5b80fccd1e
245 files changed
+2534 -137

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
"""Tests for the common_name check in tools/validate.py: no network, no numpy.
Run from the repository root:
python3 -m unittest discover tools/tests
"""
import os
import sys
import unittest
sys.dont_write_bytecode = True
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import validate as V # noqa: E402
import trail_history as H # noqa: E402
def check(rec):
errors = []
V.check_common_name("t", rec, errors)
return errors
class CommonNameTest(unittest.TestCase):
def test_none_is_valid(self):
self.assertEqual(check({"name": "Appalachian National Scenic Trail"}), [])
def test_a_different_name_is_valid(self):
self.assertEqual(check({"name": "Appalachian National Scenic Trail", "common_name": "Appalachian Trail"}), [])
def test_must_be_a_clean_string(self):
for bad in ("", " ", " Appalachian Trail", "Appalachian Trail ", 7, ["AT"]):
self.assertTrue(check({"name": "x", "common_name": bad}), repr(bad))
def test_must_differ_from_name(self):
errors = check({"name": "Long Trail", "common_name": "Long Trail"})
self.assertEqual(len(errors), 1)
self.assertIn("repeats name", errors[0])
def test_is_a_field_that_needs_history(self):
self.assertIn("common_name", H.SCHEMA_FIELDS)
self.assertNotIn("common_name", H.NOT_FACTS)
if __name__ == "__main__":
unittest.main()
+2 -2
View File
@@ -18,7 +18,7 @@ URL_RE = re.compile(r"^https?://[^\s/]+\S*$")
# Every field a record can have, as the dotted path docs/schema.md uses. A history entry
# names these. A table name on its own ("source", "hike.source") names every field in it.
_TABLES = {
"": ("id", "name", "short_name", "short_name_url", "country", "regions", "length_km",
"": ("id", "name", "common_name", "short_name", "short_name_url", "country", "regions", "length_km",
"length_note", "kind", "tier", "designation", "wave", "wave_note", "inclusion"),
"source": ("status", "publisher", "publisher_url", "url", "discovery", "format", "crs",
"licence", "licence_text", "permission_quote", "permission_by",
@@ -62,7 +62,7 @@ NOT_FACTS = (
"wave", "wave_note", # the dataset's own bookkeeping
)
FACTS_TEXT = (
"name, short_name, short_name_url, country, regions, length_km, length_note, kind, tier, designation, "
"name, common_name, short_name, short_name_url, country, regions, length_km, length_note, kind, tier, designation, "
"inclusion; source.* (status, publisher, publisher_url, url, licence, licence_text, "
"permission_*, attribution, osm_only, line_source, line_file, line_absent_reason, "
"decision, decision_text, redistributable); osm.relation; shield.* except note; "
+14
View File
@@ -456,6 +456,19 @@ def check_elevation(tid, tdir, rec, errors):
errors.append(f"{where}: source.computed must be a date (YYYY-MM-DD)")
def check_common_name(tid, rec, errors):
"""common_name is optional; where present it is the name hikers use, so it is a clean string that differs from name."""
if "common_name" not in rec:
return
name = rec["common_name"]
if not isinstance(name, str) or not name.strip():
errors.append(f"{tid}: common_name must be a non-empty string (leave it out when name is the name hikers use)")
elif name != name.strip():
errors.append(f"{tid}: common_name has a leading or trailing space")
elif name == rec.get("name"):
errors.append(f"{tid}: common_name repeats name (leave it out when they are the same)")
def check_short_name(tid, rec, errors):
"""short_name is optional; where present it needs short_name_url, the page where it was seen in use."""
name, url = rec.get("short_name"), rec.get("short_name_url")
@@ -692,6 +705,7 @@ def main():
if field not in rec or rec[field] in ("", None, []):
errors.append(f"{tid}: missing required field {field}")
check_short_name(tid, rec, errors)
check_common_name(tid, rec, errors)
if rec.get("id") != tid:
errors.append(f"{tid}: id {rec.get('id')!r} does not match directory name")
if rec.get("country") not in ("US", "CA"):