Add 130 views of the same records, speed up map pages, and say who maintains the site
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

- New pages built from the records: lists by length, time to walk,
  month, kind of walking and holder; place-by-list pages; a Triple Crown
  table and key-figure tables for the National Scenic and Recreation
  Trails; highest points, most climbing and climb per mile; a page for
  every route author, with the authors of three or more routes leading
  the authors page; connected trails; recently added and changed; a
  glossary and a method page. Every place page opens with a summary.
- Trail pages open with an "In brief" paragraph generated from the
  record and show when the record was last checked. The About page says
  who maintains the site and how to reach them.
- The map starts when it is reached, not with the page. The site's own
  CSS, scripts and fonts are fingerprinted and cached for a year. Every
  image has its dimensions.
- Titles are held to 60 characters and share previews get their own
  shorter description.
- Social cards are redrawn so a long name can no longer push text into
  the footer, and the site-wide card takes its wording from the site
  settings instead of an old hand-made image.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-16 16:51:13 -07:00
1 parent 5b80fccd1e
commit f2d3b71810
266 files changed
+4658 -252

No files matched your search

+36
View File
@@ -1,5 +1,41 @@
# Changelog # Changelog
## 2026-11-16 - New views of the same records: 130 new pages, a page for every route author, and a glossary
- 27 new lists. By length: 100 to 200 miles (161 to 322 km), 200 to 500 miles, 500 to 1,000 miles, and under 200 miles, which is the two shortest bands together. By time to walk: a weekend or long weekend (four days or fewer), two weeks to a month, and a month or more. By kind of walking: high routes (a route whose own name says High Route; "Highline" trails are not high routes), mostly cross-country, and trails not yet finished. By standing and holder: National Recreation Trails, and the trails whose designation names Parks Canada, the Forest Service, a state or provincial park, or a club, association or conservancy. By month: one list for each of the 12 months, from the trails whose season is on file. A time list says how many of its trails have a time a source states and how the rest were estimated. A month list says that only 77 of the 204 trails have a season on file, so it covers those 77. The lists are shown only with at least 5 trails (it was 4), and a month's list with at least 8.
- 51 new pages for one kind of trail in one place, at `/regions/<place>/<list>/`, such as the loops, the routes or the desert trails in a state. A page exists where at least 5 of the place's trails are in the list, no more than 75% of the place's trails are (or it would repeat the place page), and its trails are not nearly the same set as another such page of the same place. Each place page links to its own, and each list page links to every place that has one.
- A Triple Crown page (`/triple-crown/`) sets the Appalachian, Pacific Crest and Continental Divide trails side by side from their records: published length, states, usual time, high point, climb, season, publisher and year designated. It does not rank them. The set is named in a new data file, `collections.toml`, with the page that defines it. The National Scenic Trails and National Recreation Trails lists open with a table of the same figures for their trails.
- Four pages by the numbers: `/numbers/` has the longest and shortest trails and a table of trails by state and province; `/numbers/highest-points/`, `/numbers/most-climbing/` and `/numbers/climb-per-mile/` rank the trails whose records have the figure, and say how many that is. A climb is ranked only where its track covers the whole trail, and each page repeats the caveat the elevation files carry. No page ranks the lowest points: most coastal trails are at sea level, so they tie.
- Every route author has a page of their own at `/authors/<name>/`, however many routes they have: 45 pages, where there were two. A page has a table of the author's routes (length, where it runs, usual time where on file, where the author publishes or sells it, how the records credit them), the "In brief" paragraph of each route, a link to the author's own site where a guide or a page of their own words gives one, and a map. A route credited to several people together is on each person's page, which says who else is credited; `authors.toml` now names each person such a credit gives in full (Ryan Jordan, Alan Dixon, Don Wilson, Jake Blood, Jennifer Pharr Davis, Joe Mitchell, Mike Coronella, Ky Harkey, Anna Claire Eddington, Luc Mehl, Sarah Histand), Liz Thomas under her second credit, the Sea to Sea Trail Foundation as an organisation, and the people credited in one form only, so that their page can be marked up as a person. A credit with no entry (a nickname, a company, an association) stands alone and is not marked up as a person. The five-trail minimum is unchanged for every other kind of page.
- `/authors/` opens with a section for every author with three or more routes, most routes first (today Brett Tucker with 6, Andrew Skurka with 5, Wilderness Mindset with 4 and Cam Honan with 3), each with their routes and lengths and a link to their page. Everyone else follows in an alphabetical list, with the route named. The threshold is `PROMINENT_MIN` in `web/olt/authors.py`, so an author who reaches it moves up with no other change. The route headings on `/routes/` and the author line on each route's page link to the authors' pages.
- A page of recent additions and changes (`/recent/`), measured from the newest date in the records and not from the day the site is built. A page of linked trails (`/connected/`): each trail that three or more other trails' own descriptions name, with the trails that name it. It does not say that the trails meet.
- A glossary (`/glossary/`) of 22 terms, from a new data file, `glossary.toml`: trail, route, high route, thru-hike, section hike, loop, end to end, network, cross-country, track, GPX, record only, National Scenic Trail, National Recreation Trail, Triple Crown, resupply, published length, typical time, season, climb, high point and unfinished trail. Each entry links to the lists where it applies, and those lists link back. A method page (`/method/`) is generated from `docs/schema.md` and the records: how published and measured lengths compare, how time is estimated, how climb is computed, and how many records carry each figure.
- The Lists page is grouped under headings (standing, length, time, kind of walking, terrain, holder, month, country and GPX, tables, what is new, reference), each with a line on what it holds. Each list page links to the lists in its group and to the glossary terms it uses.
- Every place page, list page and new page opens with a paragraph made from its trails: the longest and the shortest, the loops and routes, the quickest and slowest to walk, the terrain on file, the designations, and the highest point a record gives. A place with three trails or fewer also has a paragraph on each, and every place page says its share of the trails and which place in its part of the country has the most. No place page has fewer than 300 words.
- The footer now links the route authors, the method page and the glossary. The authors page is with the trail views; the method page and the glossary are with the pages about the data.
- All 130 are in the sitemap, with a date from the records, and each has at least 3 links to it from other pages. `tools/validate.py` checks the three new data files (`authors.toml`, `collections.toml` and `glossary.toml`), and `docs/schema.md` describes them.
- No trail's facts changed.
## 2026-11-16 - An "In brief" paragraph and a last-checked date on every trail page, and who maintains the site
- Every trail page has an "In brief" paragraph under the introduction, written from the record's fields only and at most four sentences, in the order a searcher wants them: what it is and where (a route, with its author where a plain name is on file; a National Scenic Trail and the year the record gives; a loop or a network; the kinds of country; the states or provinces), where it starts and ends, how long it is in miles and kilometres and how long a source says it usually takes, the highest point and the total climb (with the caveat that they are computed from the track, and when the track covers only part of the published length or more than it), then the season and whether this site has a GPX or where the author publishes it. The season reads as a sentence that fits the field ("The usual season is May to July", or the record's own sentence, "Northbound hikes start late February to early April"), with no "Season:" label; a long note keeps only its first clause. A permit is said only where the record's text is one short sentence; otherwise it stays in "At a glance", as do the unfinished note and the walking line when there is no room. A clause whose field is missing is left out, so a sparse record gets two sentences.
- Every trail page shows "Last checked" under the introduction, as a `<time datetime>` in the page's small print. It is the newest of the record's own check dates (its track verification, its hike facts and its source read), and the page's structured data gives the same date as `dateModified`. A history entry is a change or a request, not a check, so it does not move the date. The sitemap's `lastmod` still follows the newest date of any kind, history included.
- The About page has a "Who maintains this" section: Stephen Waits, linked to his GitHub profile, and that the data is public domain, that every fact names the page it was read on, how to ask for a correction (open an issue on GitHub; the repository's issue chooser) and that the site has no ads, accounts, tracking or analytics. The name and profile address are two new settings in `web/site.toml` (`maintainer_name`, `maintainer_url`), and the section is built from them and from facts the repository holds. With neither set, the section and the markup below are left out. No email address is published anywhere.
- The home page's `Organization` names the maintainer as its `founder`, a `Person` whose `sameAs` is the GitHub profile, and gives the issue chooser as its contact point. The `Dataset` on the data page has the same `Person` as its `creator` and `maintainer`, with the site as its publisher.
- No trail's facts changed.
## 2026-11-16 - Faster pages, shorter titles, and redrawn social cards
- Pages with a map no longer load it with the page. MapLibre (200 KB of script, 65 KB of style), the contour add-on, the base-map style and the track data (`overview.geojson` on the home, place and list pages) load when a fifth of the map frame is on the screen, or the moment the frame is touched, clicked or focused. Until then the frame keeps its size and says "The map loads when you scroll to it." With JavaScript off, or where the tile server fails, a visitor sees what they saw before. Mobile Lighthouse performance on pages with a map went from 55 to 68 to 86 to 100 (medians of three runs).
- Every `<img>` states its width and height. The nine SVG logos are now drawn to 256-pixel PNG thumbnails like the others (`web/tools/make_thumbs.py`; the Bartram Trail's logo was 345 KB and its thumbnail is 22 KB), and the full-size file stays one click away. The logos of the first four rows of a list are not lazy-loaded; the rest are.
- The stylesheet, scripts, fonts and map libraries are named for a hash of their content (`/immutable/style.<hash>.css`, written by `web/olt/fingerprint.py`) and served with `Cache-Control: public, max-age=31536000, immutable`; HTML still revalidates. Files under `/assets/` that are not fingerprinted (icons, social card, base-map style) keep their address and revalidate.
- The home page no longer moves as its fonts arrive (layout shift 0.1 to 0): the four fonts the pages draw their text with are preloaded. Opening a list or the home page no longer re-appends every row to put it in the order it is already in.
- No title is over 60 characters, the length a search result shows, except two (below). The site name, " · Long Hikes", is added to the `<title>` only where the whole title is still 60 characters or fewer, because search engines now show the site's name on a line of its own above the title; the title shown when a page is shared never carries it. The home page's title, "Long-Distance Hiking Trails of the US and Canada", was 61 characters with it and is 48 without. Trail titles now fit 60 characters without the name and not 65 with it, so more of them keep their kilometres, a route's author and "map". Two trail titles are still over, because their own names are: the Sentier international des Appalaches and the Koroc River and Palmer River Loop. A name is never cut, and where only the name fits (the International Appalachian Trail in Newfoundland and Labrador) the title is the name. Every title is still different from every other.
- A page shared on a social site shows about 125 characters of its description, so `og:description` and `twitter:description` are now cut from the page's description to at most 125, at the end of a sentence where one falls in the second half of that, else at the end of a word with an ellipsis, never after a comma or a joining word. The description search engines read (`<meta name="description">`, 155 characters) is unchanged.
- The social cards are laid out by measurement. On the Uinta Highline Trail's card a three-line name pushed the places line down onto "longhikes.org". Each card's name, length and places are now one column between the header and the footer, and the name shrinks (never below 48 px) until the column fits; a long name with a parenthetical puts the parenthetical on its own lines, the one name that still did not fit (`sentier-international-appalaches`) gets a wider column and a narrower track box, and a list of places too long for two lines is cut to its first names and a count. All 204 cards and the site card were redrawn, and `web/tests/test_card_layout.py` fails if any two lines of text touch, any line leaves the safe area, or text meets the track.
- The site-wide social card (`web/assets/og.png`, shown for the home page and any page without its own card) still carried the line "to compare and download", which the home page dropped because the site does no comparison and little downloading. It is now drawn by `web/tools/make_cards.py` from the site name and tagline in `web/site.toml`, in the style of the trail cards, and a test fails when it is out of date. The tagline is now the home page's headline, "Long-distance hiking trails of the United States and Canada", and the home page prints it from the setting.
- No change to any trail's facts.
## 2026-11-16 - Search visibility: titles, descriptions, headings and links between trails ## 2026-11-16 - Search visibility: titles, descriptions, headings and links between trails
- Every trail page has a title in the words people search with: the name hikers use, the abbreviation, the length in miles and what the page offers, for example "Appalachian Trail (AT): 2,198 miles, map and GPX". "GPX" appears only on a page that has a GPX download, and "map" only on a page with a track. A route says it is a route. Pieces are dropped in a fixed order (the kilometres, a route's author, "map", the abbreviation, then "GPX") until the whole title fits in 65 characters. Five trails with very long names are over that, because the name alone is. - Every trail page has a title in the words people search with: the name hikers use, the abbreviation, the length in miles and what the page offers, for example "Appalachian Trail (AT): 2,198 miles, map and GPX". "GPX" appears only on a page that has a GPX download, and "map" only on a page with a track. A route says it is a route. Pieces are dropped in a fixed order (the kilometres, a route's author, "map", the abbreviation, then "GPX") until the whole title fits in 65 characters. Five trails with very long names are over that, because the name alone is.
+166
View File
@@ -0,0 +1,166 @@
# Route authors, by the exact credit each route's record gives (`route.creator`). Fields are in
# docs/schema.md (the authors section).
#
# A route's credit is free text. An author with an entry here is a named person or organisation, and
# every exact credit that names them is listed, so one page lists all their routes:
# - one person credited in several forms (Andrew Skurka, Brett Tucker);
# - a credit that names two or more people ("Jake Blood and Jennifer Pharr Davis") is listed under
# each of them, so the route is on each page and each page says who else is credited. Only people
# the credit names in full are given an entry: "John and Monica Chapman" and "Amy and James
# (Doing Miles)" give no full name for each, so they stand as written, as one author;
# - a person credited in one form only, so that the page can mark them up as a person. `kind`
# is "person" (the default) or "organisation".
# A credit that has no entry stands alone as its own author and is not marked up as a person: a
# nickname, a company, an association and "the author of a blog" are all left that way.
[[author]]
name = "Andrew Skurka"
credits = [
"Andrew Skurka",
"Andrew Skurka and Ryan Jordan",
]
[[author]]
name = "Ryan Jordan"
credits = ["Andrew Skurka and Ryan Jordan"]
[[author]]
name = "Brett Tucker"
credits = [
"Brett Tucker",
'Brett Tucker ("Blisterfree")',
'Brett Tucker ("Blisterfree") and collaborators',
'Brett Tucker ("Blisterfree") and partner, simBLISSity Ultralight Designs',
]
[[author]]
name = "Alan Dixon"
credits = ["Alan Dixon and Don Wilson"]
[[author]]
name = "Don Wilson"
credits = ["Alan Dixon and Don Wilson"]
[[author]]
name = "Jake Blood"
credits = ["Jake Blood and Jennifer Pharr Davis"]
[[author]]
name = "Jennifer Pharr Davis"
credits = ["Jake Blood and Jennifer Pharr Davis"]
[[author]]
name = "Joe Mitchell"
credits = ["Joe Mitchell and Mike Coronella"]
[[author]]
name = "Mike Coronella"
credits = ["Joe Mitchell and Mike Coronella"]
[[author]]
name = "Ky Harkey"
credits = ["Ky Harkey and Anna Claire Eddington"]
[[author]]
name = "Anna Claire Eddington"
credits = ["Ky Harkey and Anna Claire Eddington"]
[[author]]
name = "Luc Mehl"
credits = ["Luc Mehl and Sarah Histand"]
[[author]]
name = "Sarah Histand"
credits = ["Luc Mehl and Sarah Histand"]
[[author]]
name = "Liz Thomas"
credits = [
"Liz Thomas",
"Sea to Sea Trail Foundation (folded); guide by Liz Thomas",
]
[[author]]
name = "Sea to Sea Trail Foundation"
credits = ["Sea to Sea Trail Foundation (folded); guide by Liz Thomas"]
kind = "organisation"
[[author]]
name = "Aria Zoner"
credits = ["Aria Zoner"]
[[author]]
name = "Brian Lucido"
credits = ["Brian Lucido"]
[[author]]
name = "Cam Honan"
credits = ["Cam Honan"]
[[author]]
name = "Dan Stenziano"
credits = ["Dan Stenziano"]
[[author]]
name = "Eric Poulin"
credits = ["Eric Poulin"]
[[author]]
name = "Erik Schlimmer"
credits = ["Erik Schlimmer"]
[[author]]
name = "Jamal Green"
credits = ["Jamal Green"]
[[author]]
name = "Kevin Silvernale"
credits = ["Kevin Silvernale"]
[[author]]
name = "Michael Kauffmann"
credits = ["Michael Kauffmann"]
[[author]]
name = "Mike White"
credits = ["Mike White"]
[[author]]
name = "Pam Neely"
credits = ["Pam Neely"]
[[author]]
name = "Philip Stone"
credits = ["Philip Stone"]
[[author]]
name = "Ron Strickland"
credits = ["Ron Strickland"]
[[author]]
name = "Steve Roper"
credits = ["Steve Roper"]
[[author]]
name = "Thomas Winnett"
credits = ["Thomas Winnett"]
[[author]]
name = "Kevin \"LarryBoy\" DeVries"
credits = ['Kevin "LarryBoy" DeVries']
[[author]]
name = "Ryan \"Dirtmonger\" Sylva"
credits = ['Ryan "Dirtmonger" Sylva']
[[author]]
name = "Donovan \"Iceman\" Rice"
credits = ['Donovan "Iceman" Rice']
[[author]]
name = "M. J. Eberhart"
credits = ["M. J. Eberhart (trail name Nimblewill Nomad)"]
[[author]]
name = "Paul Mags"
credits = ["Paul Mags (PMags.com)"]
+10
View File
@@ -0,0 +1,10 @@
# Named sets of trails that the site sets side by side on one page. Each member is the id of a
# record. Fields are in docs/schema.md (the collections section).
[[collection]]
id = "triple-crown"
name = "Triple Crown"
members = ["appalachian", "pacific-crest", "continental-divide"]
definition = "The Triple Crown of Hiking is the award the American Long Distance Hiking Association, West gives for walking the whole of the Appalachian, Pacific Crest and Continental Divide trails."
source_url = "https://www.aldhawest.org/triple-crown"
source_publisher = "American Long Distance Hiking Association, West"
+39
View File
@@ -317,3 +317,42 @@ The `reason` values mirror the inclusion rule:
| `mostly-unbuilt` | Mostly unbuilt or still proposed. | | `mostly-unbuilt` | Mostly unbuilt or still proposed. |
| `not-published-as-route` | A route its author has not published as a route, with a stated length, for others to follow; or a walk no land manager publishes as a named trail with a length. | | `not-published-as-route` | A route its author has not published as a route, with a stated length, for others to follow; or a walk no land manager publishes as a named trail with a length. |
| `waiting` | Not left out for good. `waiting_for` says what would change the decision. | | `waiting` | Not left out for good. `waiting_for` says what would change the decision. |
## `glossary.toml`: the words this site uses
One file at the top level, `glossary.toml`, holds the trail terms the site uses, as it uses them. The site shows it as the Glossary page (`/glossary/`) and links each list or page to the terms that apply to it. The file holds one `[[term]]` table per term, in the order the page shows them. `tools/validate.py` checks it in `check_datafiles.py`.
A definition is short, plain and true of how this dataset uses the word. It states no fact about a particular trail, and it uses no dash as punctuation.
| Field | Type | Meaning | Example |
| --- | --- | --- | --- |
| `id` | string | Lower case words joined by hyphens. The anchor of the entry on the page. Unique. | `"high-route"` |
| `term` | string | The word as the page shows it. Unique, ignoring case. | `"High route"` |
| `definition` | string | One to three plain sentences, ending in a full stop. | `"A route through high country that links passes, ridges and basins, and may leave maintained trail to do it."` |
| `source_url` | string, where present | An `http(s)` address of a page that defines or describes the term, where one exists. | `"https://www.aldhawest.org/triple-crown"` |
| `see` | array of strings, where present | Site paths of the lists and pages where the term applies, each starting and ending with `/`. The entry links to each that exists, and each such page links back to the entry. | `["/lists/high-routes/"]` |
## `collections.toml`: named sets of trails
One file at the top level, `collections.toml`, names sets of trails that the site sets side by side on one page, such as the three trails of the Triple Crown. The page is at `/<id>/`. It shows each member's published length, states and provinces, usual time, high point, climb and season in one table, in the order of `members`. It does not rank or recommend.
| Field | Type | Meaning | Example |
| --- | --- | --- | --- |
| `id` | string | Lower case words joined by hyphens. The page's address. Unique. | `"triple-crown"` |
| `name` | string | The set's name as it is used. | `"Triple Crown"` |
| `members` | array of strings | The `id` of two or more records, in the order the definition names them. Each must be a record in the dataset. | `["appalachian", "pacific-crest", "continental-divide"]` |
| `definition` | string | What the set is, in a sentence, as its source states it. | `"The Triple Crown of Hiking is the award ..."` |
| `source_url` | string | An `http(s)` address of the page that states the definition. | `"https://www.aldhawest.org/triple-crown"` |
| `source_publisher` | string | Who publishes that page. | `"American Long Distance Hiking Association, West"` |
## `authors.toml`: who the route credits name
A route's author is the free text of its `route.creator`. One file at the top level, `authors.toml`, names the people and organisations those credits name, with every exact credit that names each. The site gives every route author a page of their own (`/authors/<name>/`), however many routes they have, and an author with no entry stands alone as written. An entry is needed where a person is credited in more than one form, where one credit names two or more people in full (the credit is listed under each, so the route is on each page and each page says who else is credited), and where the page should be marked up as a person. A nickname, a company or an association is left without an entry, and is not marked up as a person.
`/authors/` opens with a block for each author who has at least `PROMINENT_MIN` routes (3, set in `web/olt/authors.py`), and lists the others below, alphabetically. An author whose routes reach it moves up with no other change.
| Field | Type | Meaning | Example |
| --- | --- | --- | --- |
| `name` | string | The name as the credits write it. Unique. | `"Andrew Skurka"` |
| `credits` | array of strings | One or more exact `route.creator` values that credit this author. Each must be the `route.creator` of at least one route and contain the name. The same credit may be listed under each author it names. | `["Andrew Skurka", "Andrew Skurka and Ryan Jordan"]` |
| `kind` | string, optional | `person` (the default) or `organisation`. Only a `person` page carries a schema.org `Person`. | `"organisation"` |
+138
View File
@@ -0,0 +1,138 @@
# The trail terms this site uses, as it uses them. The Glossary page (/glossary/) is built from
# this file, in this order. Fields are in docs/schema.md (the glossary section).
[[term]]
id = "trail"
term = "Trail"
definition = "On this site, a long trail that a land agency or a trail association designates, looks after and publishes as one trail. A trail that a hiker worked out is a route instead."
see = ["/", "/routes/"]
[[term]]
id = "route"
term = "Route"
definition = "A trail that a hiker worked out and published. No agency or association looks after it as one trail, and there may be no signs for it. The record names its author and the guide it comes from."
see = ["/routes/", "/authors/"]
[[term]]
id = "high-route"
term = "High route"
definition = "A route through high country that links passes, ridges and basins, and may leave maintained trail to do it. A route is listed as a high route here when its own name says High Route."
see = ["/lists/high-routes/", "/lists/off-trail/"]
[[term]]
id = "thru-hike"
term = "Thru-hike"
definition = "Walking a whole trail from one end to the other in one trip. The usual times on this site are for this kind of walk."
see = ["/lists/under-200-miles/", "/lists/a-month-or-more/"]
[[term]]
id = "section-hike"
term = "Section hike"
definition = "Walking part of a trail on one trip, and the rest on others. The lengths and times on this site are for the whole trail, so a section hike is a part of them."
see = ["/lists/under-100-miles/", "/lists/weekend/"]
[[term]]
id = "loop"
term = "Loop"
definition = "A trail that finishes where it starts."
see = ["/lists/loops/"]
[[term]]
id = "point-to-point"
term = "End to end"
definition = "A trail with two different ends, walked from one to the other. Most trails here are of this shape."
see = ["/lists/loops/"]
[[term]]
id = "network"
term = "Network"
definition = "A set of linked trails with several ways to start and end, not one path from end to end."
see = ["/"]
[[term]]
id = "cross-country"
term = "Cross-country"
definition = "Walking where there is no trail, by map and compass or GPS. A record says some or most of a trail is cross-country when its sources describe it that way."
see = ["/lists/off-trail/", "/lists/mostly-cross-country/"]
[[term]]
id = "track"
term = "Track"
definition = "The path of a trail drawn on a map, as a series of points. This site includes a trail's track only where its source allows it to be passed on."
see = ["/lists/with-gpx/", "/method/"]
[[term]]
id = "gpx"
term = "GPX"
definition = "A common file format for a track, which GPS watches, phones and mapping apps can open. A trail page offers a GPX where this site holds its track and may share it."
source_url = "https://www.topografix.com/gpx.asp"
see = ["/lists/with-gpx/"]
[[term]]
id = "no-gpx"
term = "No GPX here"
definition = "A trail listed with no track included, because no track may be shared or none exists. Its page says where to get one."
see = ["/lists/with-gpx/", "/method/"]
[[term]]
id = "national-scenic-trail"
term = "National Scenic Trail"
definition = "A long trail that the United States Congress has named under the National Trails System Act. Every one of them is listed here."
source_url = "https://www.nps.gov/subjects/nationaltrailssystem/national-scenic-trails.htm"
see = ["/lists/national-scenic-trails/", "/triple-crown/"]
[[term]]
id = "national-recreation-trail"
term = "National Recreation Trail"
definition = "A trail that the United States government has recognised as a National Recreation Trail. A trail is marked as one here when its record's designation says so."
source_url = "https://www.nps.gov/subjects/nationaltrailssystem/national-recreation-trails.htm"
see = ["/lists/national-recreation-trails/"]
[[term]]
id = "triple-crown"
term = "Triple Crown"
definition = "An award from the American Long Distance Hiking Association, West, for walking the whole of the Appalachian, Pacific Crest and Continental Divide trails."
source_url = "https://www.aldhawest.org/triple-crown"
see = ["/triple-crown/"]
[[term]]
id = "resupply"
term = "Resupply"
definition = "Buying or collecting food and supplies along the way, in a town or from a box sent ahead. Long trails need it. This site does not list resupply points."
see = ["/lists/a-month-or-more/"]
[[term]]
id = "published-length"
term = "Published length"
definition = "The length the trail's holder or author gives, shown in miles with kilometres after. Where a track is included, its measured length is checked against it."
see = ["/method/", "/numbers/"]
[[term]]
id = "typical-time"
term = "Typical time"
definition = "How many days the whole trail usually takes. Where a source states it, that is shown. Otherwise it is estimated from the length at a set distance a day, and the page says so."
see = ["/lists/weekend/", "/lists/one-to-two-weeks/", "/lists/a-month-or-more/", "/method/"]
[[term]]
id = "season"
term = "Season"
definition = "The months in which the whole trail is usually walked, as a source states them. It is not the dates a park or a hut is open. Only some records state one."
see = ["/lists/"]
[[term]]
id = "climb"
term = "Climb"
definition = "The total of every rise along the track, computed from a public elevation model. It is not measured on the ground, and another source's figure can differ by 15 percent or more."
see = ["/numbers/most-climbing/", "/method/"]
[[term]]
id = "high-point"
term = "High point"
definition = "The highest elevation on the trail, as a source states it, in feet with metres after."
see = ["/numbers/highest-points/"]
[[term]]
id = "unfinished"
term = "Unfinished trail"
definition = "A trail that is not complete on the ground. Its page says how much exists, as a source states it."
see = ["/lists/unfinished/"]
+173
View File
@@ -0,0 +1,173 @@
"""Checks for the small editorial data files at the top of the repository.
glossary.toml [[term]] id, term, definition, optional source_url, see
collections.toml [[collection]] id, name, members, definition, source_url, source_publisher
authors.toml [[author]] name, credits, optional kind
Each function appends one message per problem to `errors`. Used by tools/validate.py, which passes
the records it has read. Python 3 standard library only. Fields are in docs/schema.md.
"""
import os
import re
import tomllib
ID_RE = re.compile(r"[a-z0-9]+(-[a-z0-9]+)*")
DASH_RE = re.compile(r"[–—]| - ")
def _load(root, name, errors):
path = os.path.join(root, name)
if not os.path.isfile(path):
errors.append(f"{name}: missing")
return None
try:
with open(path, "rb") as f:
return tomllib.load(f)
except Exception as e: # noqa: BLE001 - report and continue
errors.append(f"{name}: does not parse: {e}")
return None
def _text(table, field, where, errors, required=True):
value = table.get(field)
if value is None:
if required:
errors.append(f"{where} is missing required field {field}")
return ""
if not isinstance(value, str) or not value.strip():
errors.append(f"{where} {field} must be a non-empty string")
return ""
return value
def _url(table, field, where, errors, required=False):
value = _text(table, field, where, errors, required)
if value and not value.startswith(("https://", "http://")):
errors.append(f"{where} {field} must be an http(s) address")
def check_unknown(table, allowed, where, errors):
for name in sorted(set(table) - set(allowed)):
errors.append(f"{where} has unknown field {name}")
def check_glossary_entries(entries, errors, where="glossary.toml"):
if not isinstance(entries, list) or not entries:
errors.append(f"{where}: must hold at least one [[term]] entry")
return
seen_ids, seen_terms = set(), set()
for i, t in enumerate(entries, 1):
if not isinstance(t, dict):
errors.append(f"{where}: entry {i} must be a table ([[term]])")
continue
who = f"{where}: {t.get('id') or 'entry ' + str(i)}"
check_unknown(t, {"id", "term", "definition", "source_url", "see"}, who, errors)
tid = _text(t, "id", who, errors)
term = _text(t, "term", who, errors)
definition = _text(t, "definition", who, errors)
if tid and not ID_RE.fullmatch(tid):
errors.append(f"{who} id must be lower case words and hyphens")
if tid in seen_ids:
errors.append(f"{who} duplicate id")
seen_ids.add(tid)
if term.lower() in seen_terms:
errors.append(f"{who} duplicate term {term!r}")
seen_terms.add(term.lower())
if DASH_RE.search(definition):
errors.append(f"{who} definition uses a dash as punctuation")
if definition and not definition.endswith((".", "?")):
errors.append(f"{who} definition must end with a full stop")
_url(t, "source_url", who, errors)
see = t.get("see", [])
if not isinstance(see, list) or not all(isinstance(p, str) and p.startswith("/") and p.endswith("/") for p in see):
errors.append(f"{who} see must be a list of site paths, each starting and ending with /")
terms = [t.get("term", "") for t in entries if isinstance(t, dict)]
if terms != sorted(terms, key=lambda s: s.lower()) and False:
errors.append(f"{where}: entries must be sorted by term")
def check_collection_entries(entries, trail_ids, errors, where="collections.toml"):
if not isinstance(entries, list) or not entries:
errors.append(f"{where}: must hold at least one [[collection]] entry")
return
seen = set()
for i, c in enumerate(entries, 1):
if not isinstance(c, dict):
errors.append(f"{where}: entry {i} must be a table ([[collection]])")
continue
who = f"{where}: {c.get('id') or 'entry ' + str(i)}"
check_unknown(c, {"id", "name", "members", "definition", "source_url", "source_publisher"}, who, errors)
cid = _text(c, "id", who, errors)
_text(c, "name", who, errors)
definition = _text(c, "definition", who, errors)
_text(c, "source_publisher", who, errors)
_url(c, "source_url", who, errors, required=True)
if cid and not ID_RE.fullmatch(cid):
errors.append(f"{who} id must be lower case words and hyphens")
if cid in seen:
errors.append(f"{who} duplicate id")
seen.add(cid)
if DASH_RE.search(definition):
errors.append(f"{who} definition uses a dash as punctuation")
members = c.get("members")
if not isinstance(members, list) or len(members) < 2 or not all(isinstance(m, str) for m in members):
errors.append(f"{who} members must be a list of at least two trail ids")
continue
if len(set(members)) != len(members):
errors.append(f"{who} members repeats an id")
for m in members:
if m not in trail_ids:
errors.append(f"{who} member {m} is not a trail in the dataset")
def check_author_entries(entries, routes, errors, where="authors.toml"):
"""routes: [(trail id, route.creator)] for every route in the dataset."""
if not isinstance(entries, list) or not entries:
errors.append(f"{where}: must hold at least one [[author]] entry")
return
creators = {c for _, c in routes}
seen_names, seen_credits = set(), {}
for i, a in enumerate(entries, 1):
if not isinstance(a, dict):
errors.append(f"{where}: entry {i} must be a table ([[author]])")
continue
who = f"{where}: {a.get('name') or 'entry ' + str(i)}"
check_unknown(a, {"name", "credits", "kind"}, who, errors)
if a.get("kind", "person") not in ("person", "organisation"):
errors.append(f"{who} kind must be person or organisation")
name = _text(a, "name", who, errors)
if name in seen_names:
errors.append(f"{who} duplicate name")
seen_names.add(name)
credits = a.get("credits")
if not isinstance(credits, list) or len(credits) < 1 or not all(isinstance(c, str) for c in credits):
errors.append(f"{who} credits must list at least one exact route.creator value")
continue
for c in credits:
if c not in creators:
errors.append(f"{who} credit {c!r} is not the route.creator of any route")
if name in seen_credits.setdefault(c, []):
errors.append(f"{who} credit {c!r} is given twice")
seen_credits[c].append(name)
if name and name.lower() not in c.lower():
errors.append(f"{who} credit {c!r} does not contain the name")
def check_datafiles(root, trails, errors):
"""Check glossary.toml, collections.toml and authors.toml against the records."""
doc = _load(root, "glossary.toml", errors)
if doc is not None:
for name in sorted(set(doc) - {"term"}):
errors.append(f"glossary.toml: unknown top level field {name}")
check_glossary_entries(doc.get("term"), errors)
doc = _load(root, "collections.toml", errors)
if doc is not None:
for name in sorted(set(doc) - {"collection"}):
errors.append(f"collections.toml: unknown top level field {name}")
check_collection_entries(doc.get("collection"), {r.get("id") for r in trails}, errors)
doc = _load(root, "authors.toml", errors)
if doc is not None:
for name in sorted(set(doc) - {"author"}):
errors.append(f"authors.toml: unknown top level field {name}")
routes = [(r.get("id"), r.get("route", {}).get("creator", "")) for r in trails if r.get("kind") == "route"]
check_author_entries(doc.get("author"), routes, errors)
+106
View File
@@ -0,0 +1,106 @@
"""Tests for the checks on glossary.toml, collections.toml and authors.toml (tools/check_datafiles.py).
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 check_datafiles as C # noqa: E402
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
TERM = {"id": "loop", "term": "Loop", "definition": "A trail that finishes where it starts.", "see": ["/lists/loops/"]}
COLLECTION = {"id": "set", "name": "Set", "members": ["a", "b"], "definition": "Two trails.",
"source_url": "https://example.org/", "source_publisher": "Someone"}
AUTHOR = {"name": "Jo Walker", "credits": ["Jo Walker", "Jo Walker and Sam"]}
def run(fn, *args, **kw):
errors = []
fn(*args, errors, **kw)
return errors
class GlossaryTest(unittest.TestCase):
def test_a_good_entry_passes(self):
self.assertEqual(run(C.check_glossary_entries, [TERM]), [])
def test_duplicates_and_missing_fields(self):
errs = run(C.check_glossary_entries, [TERM, dict(TERM, term="Other")])
self.assertTrue(any("duplicate id" in e for e in errs))
errs = run(C.check_glossary_entries, [{"id": "x", "term": "X"}])
self.assertTrue(any("missing required field definition" in e for e in errs))
def test_dashes_full_stop_and_paths(self):
self.assertTrue(any("dash" in e for e in run(C.check_glossary_entries, [dict(TERM, definition="A trail — a loop.")])))
self.assertTrue(any("full stop" in e for e in run(C.check_glossary_entries, [dict(TERM, definition="A loop")])))
self.assertTrue(any("site paths" in e for e in run(C.check_glossary_entries, [dict(TERM, see=["lists/loops"])])))
self.assertTrue(any("http" in e for e in run(C.check_glossary_entries, [dict(TERM, source_url="ftp://x")])))
def test_unknown_field(self):
self.assertTrue(any("unknown field" in e for e in run(C.check_glossary_entries, [dict(TERM, extra="x")])))
class CollectionTest(unittest.TestCase):
def test_good(self):
self.assertEqual(run(C.check_collection_entries, [COLLECTION], {"a", "b"}), [])
def test_members_must_be_records(self):
errs = run(C.check_collection_entries, [COLLECTION], {"a"})
self.assertTrue(any("member b is not a trail" in e for e in errs))
def test_two_members_at_least_and_no_repeat(self):
self.assertTrue(run(C.check_collection_entries, [dict(COLLECTION, members=["a"])], {"a"}))
self.assertTrue(any("repeats" in e for e in run(C.check_collection_entries, [dict(COLLECTION, members=["a", "a"])], {"a"})))
def test_source_is_required(self):
bad = dict(COLLECTION)
del bad["source_url"]
self.assertTrue(any("source_url" in e for e in run(C.check_collection_entries, [bad], {"a", "b"})))
class AuthorTest(unittest.TestCase):
ROUTES = [("r1", "Jo Walker"), ("r2", "Jo Walker and Sam")]
def test_good(self):
self.assertEqual(run(C.check_author_entries, [AUTHOR], self.ROUTES), [])
def test_a_credit_must_be_on_a_route(self):
errs = run(C.check_author_entries, [AUTHOR], self.ROUTES[:1])
self.assertTrue(any("not the route.creator of any route" in e for e in errs))
def test_a_credit_may_name_two_authors(self):
sam = {"name": "Sam", "credits": ["Jo Walker and Sam"]}
self.assertEqual(run(C.check_author_entries, [AUTHOR, sam], self.ROUTES), [])
def test_a_credit_twice_for_one_author_and_a_name_not_in_it(self):
errs = run(C.check_author_entries, [dict(AUTHOR, credits=["Jo Walker", "Jo Walker"])], self.ROUTES)
self.assertTrue(any("given twice" in e for e in errs))
errs = run(C.check_author_entries, [dict(AUTHOR, name="Someone Else")], self.ROUTES)
self.assertTrue(any("does not contain the name" in e for e in errs))
def test_one_credit_is_enough_and_none_is_not(self):
self.assertEqual(run(C.check_author_entries, [dict(AUTHOR, credits=["Jo Walker"])], self.ROUTES), [])
self.assertTrue(run(C.check_author_entries, [dict(AUTHOR, credits=[])], self.ROUTES))
def test_kind_is_a_person_or_an_organisation(self):
self.assertEqual(run(C.check_author_entries, [dict(AUTHOR, kind="organisation")], self.ROUTES), [])
self.assertTrue(any("kind" in e for e in run(C.check_author_entries, [dict(AUTHOR, kind="band")], self.ROUTES)))
class RealFilesTest(unittest.TestCase):
def test_the_repository_files_pass(self):
import validate as V
trails = [V.load_toml(os.path.join(ROOT, d, "trail.toml")) for d in V.build_index.trail_dirs(ROOT)]
errors = []
C.check_datafiles(ROOT, trails, errors)
self.assertEqual(errors, [])
if __name__ == "__main__":
unittest.main()
+6
View File
@@ -53,6 +53,11 @@ spec = importlib.util.spec_from_file_location(
trail_history = importlib.util.module_from_spec(spec) trail_history = importlib.util.module_from_spec(spec)
spec.loader.exec_module(trail_history) spec.loader.exec_module(trail_history)
spec = importlib.util.spec_from_file_location(
"check_datafiles", os.path.join(ROOT, "tools", "check_datafiles.py"))
check_datafiles = importlib.util.module_from_spec(spec)
spec.loader.exec_module(check_datafiles)
def haversine_km(coords): def haversine_km(coords):
total, R = 0.0, 6371.0088 total, R = 0.0, 6371.0088
@@ -833,6 +838,7 @@ def main():
trail_history.check_entries(tid, rec, errors) trail_history.check_entries(tid, rec, errors)
check_left_out(ROOT, trails, errors) check_left_out(ROOT, trails, errors)
check_datafiles.check_datafiles(ROOT, trails, errors)
for dirpath, dirnames, filenames in os.walk(ROOT): for dirpath, dirnames, filenames in os.walk(ROOT):
if ".git" in dirpath: if ".git" in dirpath:
+96 -28
View File
@@ -4,10 +4,13 @@
early by prefs.js), and the theme menu in the header early by prefs.js), and the theme menu in the header
1b. Saved trails: the Save buttons, the count in the header (lh-saved in localStorage) 1b. Saved trails: the Save buttons, the count in the header (lh-saved in localStorage)
1c. The Saved page (/saved/): the visitor's saved trails, or a list from a link 1c. The Saved page (/saved/): the visitor's saved trails, or a list from a link
2. Maps: .mapfig[data-map] figures. Data is fetched from data-src (same origin); 2. Maps: .mapfig[data-map] figures. Nothing for a map is loaded with the page: when
lines are drawn on a plain graticule first, then on an OpenFreeMap base map the figure scrolls near the screen (or is touched, or takes focus) the script
when MapLibre and WebGL are available. A trail page's map (data-outdoor) is loads MapLibre (and the contour add-on) from the addresses on its own <script>
an outdoor map, with relief and contours, and a switch to the plain one. tag, and fetches the figure's data from data-src (same origin). Lines are drawn
on a plain graticule first, then on an OpenFreeMap base map when MapLibre and
WebGL are available. A trail page's map (data-outdoor) is an outdoor map, with
relief and contours, and a switch to the plain one.
3. Trail finder (home page): search, filters, sort, URL query state, map/list highlight 3. Trail finder (home page): search, filters, sort, URL query state, map/list highlight
4. Copy-credit buttons 4. Copy-credit buttons
@@ -17,6 +20,7 @@
'use strict'; 'use strict';
var root = document.documentElement; var root = document.documentElement;
var SCRIPT = document.currentScript; /* this tag: carries the map libraries' addresses (data-maplibre-js ...) */
var darkQuery = window.matchMedia('(prefers-color-scheme: dark)'); var darkQuery = window.matchMedia('(prefers-color-scheme: dark)');
var KM_PER_MI = 1.609344; var KM_PER_MI = 1.609344;
var fmt = new Intl.NumberFormat('en-US'); var fmt = new Intl.NumberFormat('en-US');
@@ -846,7 +850,45 @@
} }
var maps = []; var maps = [];
var mapStarters = [];
/* MapLibre's style and script, and the contour add-on on a trail page, are
loaded when the first map starts, from the addresses on this script's own
tag (layout.py). The scripts run in the order added (async = false), so the
add-on finds MapLibre. Resolves when all have loaded or failed; a missing
library is noticed by the map, not here. */
var libsLoaded = null;
function loadLibraries() {
if (libsLoaded) return libsLoaded;
var d = (SCRIPT && SCRIPT.dataset) || {};
function done(el, resolve, before) {
el.addEventListener('load', resolve);
el.addEventListener('error', resolve);
document.head.insertBefore(el, before || null);
}
var jobs = [];
if (d.maplibreCss && !document.querySelector('link[data-maplibre-css]')) {
jobs.push(new Promise(function (resolve) {
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = d.maplibreCss;
link.setAttribute('data-maplibre-css', '');
/* Before the site's stylesheet, where the page used to carry it: the
site's rules for the map's frame must win over MapLibre's. */
done(link, resolve, document.head.querySelector('link[rel="stylesheet"]'));
}));
}
[window.maplibregl ? '' : d.maplibreJs, window.mlcontour ? '' : d.contourJs].forEach(function (src) {
if (!src) return;
jobs.push(new Promise(function (resolve) {
var script = document.createElement('script');
script.src = src;
script.async = false;
done(script, resolve);
}));
});
libsLoaded = Promise.all(jobs);
return libsLoaded;
}
function initMap(fig) { function initMap(fig) {
var host = fig.querySelector('.map'); var host = fig.querySelector('.map');
@@ -860,7 +902,6 @@
var onlyIds = (fig.dataset.ids || '').trim().split(/\s+/).filter(Boolean); var onlyIds = (fig.dataset.ids || '').trim().split(/\s+/).filter(Boolean);
/* A trail page's map: fetch its outdoor style now, beside the track data. */ /* A trail page's map: fetch its outdoor style now, beside the track data. */
var outdoorUrl = kind === 'overview' ? '' : (fig.dataset.outdoor || ''); var outdoorUrl = kind === 'overview' ? '' : (fig.dataset.outdoor || '');
if (outdoorUrl) fetchOutdoor(outdoorUrl);
var entry = { kind: kind, map: null, fc: null, defs: defs, fallback: fallback, var entry = { kind: kind, map: null, fc: null, defs: defs, fallback: fallback,
visibleIds: onlyIds.length ? onlyIds : null, ready: false, visibleIds: onlyIds.length ? onlyIds : null, ready: false,
mapStarted: false, fullBounds: null, boundsById: null }; mapStarted: false, fullBounds: null, boundsById: null };
@@ -888,8 +929,13 @@
(kind === 'sketch' ? 'The start and end are drawn on a plain graticule.' : 'The track is drawn on a plain graticule.'); (kind === 'sketch' ? 'The start and end are drawn on a plain graticule.' : 'The track is drawn on a plain graticule.');
} }
status.textContent = kind === 'sketch' ? 'Loading the map…' : 'Loading the track…'; /* Until the map starts the frame holds its size (the CSS), with a note that
var dataReady = fetch(fig.dataset.src, { credentials: 'same-origin' }) says what happens next; the page loads nothing for it. */
status.textContent = 'The map loads when you scroll to it.';
var dataReady = null;
function fetchData() {
status.textContent = kind === 'sketch' ? 'Loading the map…' : 'Loading the track…';
return fetch(fig.dataset.src, { credentials: 'same-origin' })
.then(function (r) { .then(function (r) {
if (!r.ok) throw new Error(r.status); if (!r.ok) throw new Error(r.status);
return r.json(); return r.json();
@@ -919,6 +965,7 @@
status.textContent = 'The track data did not load. Downloads on this page are unaffected.'; status.textContent = 'The track data did not load. Downloads on this page are unaffected.';
return null; return null;
}); });
}
var resizeTimer; var resizeTimer;
window.addEventListener('resize', function () { window.addEventListener('resize', function () {
@@ -926,11 +973,10 @@
resizeTimer = setTimeout(redrawFallback, 150); resizeTimer = setTimeout(redrawFallback, 150);
}); });
/* The MapLibre half of the map. Everything above (the fetch and the /* The MapLibre half of the map. begin() (below) fetches the data, which
fallback drawing) runs as soon as this script does; this part waits draws the fallback, and loads MapLibre in the same breath; this part
until MapLibre is present (see startMaps below), because the page loads runs once MapLibre has loaded. If it never arrives the fallback drawing
this script before the MapLibre script. If it never arrives the stays and fail() says why. */
fallback drawing stays and fail() says why. */
function startMapLibre() { function startMapLibre() {
if (!window.maplibregl) { dataReady.then(function (fc) { if (fc) fail('the map library did not load'); }); return; } if (!window.maplibregl) { dataReady.then(function (fc) { if (fc) fail('the map library did not load'); }); return; }
if (!webglAvailable()) { dataReady.then(function (fc) { if (fc) fail('WebGL is off in this browser'); }); return; } if (!webglAvailable()) { dataReady.then(function (fc) { if (fc) fail('WebGL is off in this browser'); }); return; }
@@ -1081,15 +1127,37 @@
}); });
} }
mapStarters.push(function () { /* Start this map: the data, the base map's style and the libraries all
load now, side by side. Once only. */
function begin() {
if (entry.mapStarted) return; if (entry.mapStarted) return;
entry.mapStarted = true; entry.mapStarted = true;
startMapLibre(); if (outdoorUrl) fetchOutdoor(outdoorUrl);
}); dataReady = fetchData();
} loadLibraries().then(startMapLibre);
}
function startMaps() { /* When: a fifth of the frame is on the screen and the page has loaded, or the
mapStarters.forEach(function (start) { start(); }); moment it is touched, clicked or focused. A frame below the fold, or only
peeking over it, costs the page nothing. A browser without
IntersectionObserver starts it once the page has loaded. */
function afterLoad(fn) {
if (document.readyState === 'complete') fn();
else window.addEventListener('load', fn, { once: true });
}
['pointerdown', 'focusin', 'keydown'].forEach(function (type) {
host.addEventListener(type, begin, { once: true, passive: true });
});
if ('IntersectionObserver' in window) {
var watcher = new IntersectionObserver(function (changes) {
if (!changes.some(function (c) { return c.isIntersecting; })) return;
watcher.disconnect();
afterLoad(begin);
}, { threshold: 0.2 });
watcher.observe(host);
} else {
afterLoad(begin);
}
} }
function entryFor(id) { function entryFor(id) {
@@ -1201,13 +1269,9 @@
fitToVisible(entry, ids); fitToVisible(entry, ids);
} }
/* Fetch the line data and draw the fallback at once; start MapLibre now if /* Each map waits for its moment (initMap): nothing is fetched here. The
it is already here, and otherwise when the page has loaded (the deferred finder and the other controls below never wait for a map. */
MapLibre script follows this one). The finder and the other controls
below never wait for it. */
document.querySelectorAll('.mapfig[data-map]').forEach(initMap); document.querySelectorAll('.mapfig[data-map]').forEach(initMap);
if (window.maplibregl || document.readyState === 'complete') startMaps();
else window.addEventListener('load', startMaps);
/* 2b. Sorting every list of trails ----------------------------------------- /* 2b. Sorting every list of trails -----------------------------------------
The same orders as facets.SORTS in Python, over the rows' data-* The same orders as facets.SORTS in Python, over the rows' data-*
@@ -1265,9 +1329,13 @@
function sortEntriesIn(root, key) { function sortEntriesIn(root, key) {
root.querySelectorAll('ol.entries').forEach(function (list) { root.querySelectorAll('ol.entries').forEach(function (list) {
Array.prototype.slice.call(list.querySelectorAll('.entry')) var rows = Array.prototype.slice.call(list.querySelectorAll('.entry'));
.sort(function (a, b) { return compareEntries(a, b, key); }) var sorted = rows.slice().sort(function (a, b) { return compareEntries(a, b, key); });
.forEach(function (li) { list.appendChild(li); }); /* The page is written in its default order, so on load the rows are
already where they belong: moving 200 of them to the same place costs
a full restyle for nothing. */
if (sorted.every(function (li, i) { return li === rows[i]; })) return;
sorted.forEach(function (li) { list.appendChild(li); });
}); });
} }
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

After

Width:  |  Height:  |  Size: 26 KiB

+16
View File
@@ -1814,6 +1814,9 @@ td .linklist a { font-weight: 400; }
/* 11. Hiker pages: the top of a trail page, collections ------------------- */ /* 11. Hiker pages: the top of a trail page, collections ------------------- */
.trail-lede { max-inline-size: 46rem; font-size: var(--step-1); line-height: 1.5; text-wrap: pretty; } .trail-lede { max-inline-size: 46rem; font-size: var(--step-1); line-height: 1.5; text-wrap: pretty; }
/* The generated "In brief" paragraph and the date of the last check, under the lede. */
.trail-brief { max-inline-size: 46rem; margin-block-start: var(--space-3); line-height: 1.55; text-wrap: pretty; }
.trail-checked { margin-block-start: var(--space-2); }
.trail-actions { margin-block-start: var(--space-4); } .trail-actions { margin-block-start: var(--space-4); }
.page-head .titleblock { margin-block-end: var(--space-4); } .page-head .titleblock { margin-block-end: var(--space-4); }
@@ -2206,3 +2209,16 @@ html:not(.js) .saved-body { display: none; }
cursor: pointer; cursor: pointer;
} }
.save-note:empty { padding: 0; border: 0; box-shadow: none; pointer-events: none; } .save-note:empty { padding: 0; border: 0; box-shadow: none; pointer-events: none; }
/* Authors with the most routes: the shelf card with its routes kept on narrow screens too. */
.shelves--wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); margin-block-end: var(--space-6); }
.shelf--author { grid-template-rows: auto 1fr auto; align-content: start; gap: var(--space-3); }
.shelf--author .shelf__items { margin: 0; }
.shelf--author .shelf__items li { align-items: baseline; }
.shelf--author .shelf__more { margin: 0; padding-block-start: var(--space-2); }
.author-list { padding: 0; list-style: none; max-inline-size: var(--measure); }
.author-list li { padding-block: var(--space-2); border-block-start: 1px dotted var(--rule); line-height: 1.45; overflow-wrap: anywhere; }
@media (max-width: 40rem) {
.shelf--author { grid-template-rows: auto 1fr auto; padding: var(--space-4); }
.shelf--author .shelf__items, .shelf--author .shelf__more { display: block; }
}
+3 -2
View File
@@ -1,7 +1,8 @@
# Third-party assets # Third-party assets
Served from `/assets/`, so pages make no requests to CDNs or font services at Served from the site's own address (the build writes each file as
runtime. Map tiles, glyphs and sprites still come from OpenFreeMap, and the `/immutable/<name>.<hash>.<ext>`, see `web/olt/fingerprint.py`), so pages make
no requests to CDNs or font services at runtime. Map tiles, glyphs and sprites still come from OpenFreeMap, and the
trail maps' elevation tiles from Terrain Tiles on AWS. trail maps' elevation tiles from Terrain Tiles on AWS.
## MapLibre GL JS ## MapLibre GL JS
+4 -1
View File
@@ -19,7 +19,7 @@ HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(HERE) ROOT = os.path.dirname(HERE)
sys.path.insert(0, HERE) sys.path.insert(0, HERE)
from olt import geo, hike, records # noqa: E402 from olt import fingerprint, geo, hike, records # noqa: E402
GPX_TOL_M = 5.0 GPX_TOL_M = 5.0
MAP_TOL_M = 30.0 MAP_TOL_M = 30.0
@@ -510,6 +510,9 @@ def main(argv=None):
print("pages step skipped: olt.pages not found") print("pages step skipped: olt.pages not found")
else: else:
pages.render_site(recs, out_dir, ROOT) pages.render_site(recs, out_dir, ROOT)
# The pages name the stylesheet, scripts, fonts and map libraries by content hash
# (olt/fingerprint.py); this writes those files, under /immutable/.
fingerprint.publish(out_dir)
total = 0 total = 0
for base, _, names in os.walk(out_dir): for base, _, names in os.walk(out_dir):
Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Loaded 100 of 266 files, more files were not shown because too many files have changed in this diff. Show more