Add 130 views of the same records, speed up map pages, and say who maintains the site
- 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:
1 parent
5b80fccd1e
commit
f2d3b71810
266 files changed
+4658
-252
No files matched your search
@@ -196,7 +196,7 @@ class JsonLdTest(unittest.TestCase):
|
||||
self.assertEqual(place["url"], f"{BASE}/trails/{rec['id']}/")
|
||||
page = next(n for n in nodes if n["@type"] == "ItemPage")
|
||||
self.assertEqual(page["mainEntity"]["@id"], place["@id"])
|
||||
self.assertEqual(page["dateModified"], seo.modified(rec))
|
||||
self.assertEqual(page["dateModified"], seo.checked(rec))
|
||||
self.assertRegex(page["dateModified"], r"^\d{4}-\d{2}-\d{2}$")
|
||||
count += 1
|
||||
self.assertEqual(count, len(self.records))
|
||||
@@ -285,7 +285,7 @@ class JsonLdTest(unittest.TestCase):
|
||||
self.assertTrue(os.path.isfile(os.path.join(OUT, "assets", "apple-touch-icon.png")))
|
||||
# only what site.toml holds: the repository, and a contact when one is set
|
||||
self.assertEqual(org.get("sameAs", []), [SITE.repo_url] if SITE.repo_url else [])
|
||||
self.assertEqual("email" in org or "contactPoint" in org, bool(SITE.contact_url))
|
||||
self.assertEqual("email" in org or "contactPoint" in org, bool(SITE.contact))
|
||||
web = next(n for n in home if n["@type"] == "WebSite")
|
||||
self.assertEqual(web["publisher"], {"@id": org["@id"]})
|
||||
data = nodes_of(self.pages["data/index.html"])
|
||||
@@ -303,7 +303,9 @@ class JsonLdTest(unittest.TestCase):
|
||||
self.assertTrue(os.path.isfile(os.path.join(OUT, *path.split("/"))), path)
|
||||
self.assertTrue(all("name" in v for v in ds["variableMeasured"]))
|
||||
self.assertIn("United States", ds["description"])
|
||||
self.assertEqual(ds["creator"]["name"], SITE.name)
|
||||
# one maintainer, named by name and profile page: the Person is the creator, the site the publisher
|
||||
self.assertEqual(ds["creator"]["name"], SITE.maintainer_name or SITE.name)
|
||||
self.assertEqual(ds["publisher"]["name"], SITE.name)
|
||||
|
||||
def test_no_wording_the_house_style_forbids(self):
|
||||
for path in ("data/index.html", "index.html", "trails/long-trail/index.html"):
|
||||
@@ -347,6 +349,15 @@ class CardsTest(unittest.TestCase):
|
||||
stored = cards.stored_fingerprint(os.path.join(WEB, "cards", f"{rec['id']}.png"))
|
||||
self.assertEqual(stored, cards.fingerprint(rec), f"{rec['id']}: card is stale")
|
||||
|
||||
def test_site_card_is_not_stale(self):
|
||||
"""assets/og.png shows the site name and tagline from web/site.toml. A changed setting
|
||||
fails here until web/tools/make_cards.py has redrawn it."""
|
||||
cfg = site.from_file(os.path.join(WEB, "site.toml"))
|
||||
self.assertEqual(cards.stored_fingerprint(os.path.join(WEB, "assets", "og.png")),
|
||||
cards.site_fingerprint(cfg), "assets/og.png is stale")
|
||||
self.assertEqual(thumbs.png_size(os.path.join(WEB, "assets", "og.png")), (1200, 630))
|
||||
self.assertEqual(meta(read("index.html"), "og:image"), f"{BASE}/assets/og.png")
|
||||
|
||||
def test_no_card_for_a_record_that_is_gone(self):
|
||||
ids = {r["id"] for r in self.records}
|
||||
cards = {n[:-4] for n in os.listdir(os.path.join(WEB, "cards")) if n.endswith(".png")}
|
||||
|
||||
Reference in new issue
Block a user