Say what each page is in the words people search with, and mark up the facts
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:
1 parent
a46338afd5
commit
5b80fccd1e
245 files changed
+2534
-137
No files matched your search
@@ -50,6 +50,34 @@ def partial_short_text(rec):
|
||||
f"{words.length(rec['length_km'], mi=rec['derived']['length_mi'])} published")
|
||||
|
||||
|
||||
# A search result shows about this much. The title limit counts the whole title,
|
||||
# the site name included.
|
||||
TITLE_LIMIT = 65
|
||||
DESCRIPTION_LIMIT = 155
|
||||
|
||||
|
||||
def title_room(site):
|
||||
"""How many characters a page's own title may have, before " · <site name>"."""
|
||||
return TITLE_LIMIT - len(site.name) - len(" \u00b7 ")
|
||||
|
||||
|
||||
def fit_title(options, site):
|
||||
"""The first of options (richest first) that fits title_room; else the last, the shortest."""
|
||||
return next((o for o in options if len(o) <= title_room(site)), options[-1])
|
||||
|
||||
|
||||
def plain_name(rec):
|
||||
"""The name hikers use (common_name) where the record has one, else its name. Plain text."""
|
||||
return rec.get("common_name") or rec["name"]
|
||||
|
||||
|
||||
def cut_at_word(text, limit):
|
||||
"""text if it fits, else cut at a word with an ellipsis, within limit characters."""
|
||||
if len(text) <= limit:
|
||||
return text
|
||||
return text[:limit - 1].rsplit(" ", 1)[0].rstrip(" ,;:.") + "\u2026"
|
||||
|
||||
|
||||
def name(rec):
|
||||
"""The record's name as HTML text, marked with its language when it is not
|
||||
English (web/site.toml [name_lang], copied to derived.name_lang by pages.py).
|
||||
|
||||
Reference in new issue
Block a user