- JavaScript 64.6%
- HTML 27.5%
- CSS 7.6%
- Python 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .github | ||
| _restore | ||
| data | ||
| docs | ||
| drives/build | ||
| privacy | ||
| public | ||
| qa/fixtures/culture-test | ||
| roads-and-rails | ||
| scripts | ||
| src | ||
| .env.example | ||
| .gitignore | ||
| amplify.yml | ||
| customHttp.yml | ||
| index.html | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| vite.config.js | ||
kyhistorydrive.com
Web companion to the KY Markers Drive iOS app — Kentucky Historical Society markers on an open-source map, plus Stories and a filterable Timeline built from daily Kentucky History morning briefs.
Stack
- Vite static site
- MapLibre GL JS (no Google Maps / MapKit JS)
- marked for story markdown
- Basemap: CARTO Voyager raster (OSM data) — needs
VITE_CARTO_API_KEY(free key from https://carto.com/basemaps/apikey/) - Optional overlay: OpenHistoricalMap tiles
- Marker data: GeoJSON derived from
ky-markers-drivedata/markers.phase1.json - Stories:
public/content/stories/*.json+public/content/stories.jsonindex
Routes (hash)
| Path | View |
|---|---|
/ |
Magazine homepage (Kentucky history highlights) |
/#map |
Marker map |
/#timeline |
Era + year-range filtered timeline |
/#timeline/<slug> |
Story detail on Timeline |
/#about |
About |
/#app |
iOS app |
/home-preview |
Redirects to / |
/roads-and-rails/, /roads-rails/ |
301 to / (map); off the live site since Oct 19, 2026 |
Nav: Home | Map | Timeline | About | App (logo also goes Home)
Roads & Rails (off, kept in the repo)
Shannon took Roads & Rails off the live site on Oct 19, 2026. The code and data stay in the repo
(roads-and-rails/index.html, src/roads-and-rails.js, src/transport-*.js, public/maps/transport/,
scripts/*transport*). The default build leaves out the page, its nav item, the inline story links and its
sitemap entry, skips the transport checks (scripts/roads-rails-checks.mjs), prunes the page-only assets from
dist/ (maps/transport/, brand/og-roads-and-rails.png, data/web/transport-links.json; scripts/prune-roads-rails-assets.mjs),
and writes noindex stubs at
/roads-and-rails/ and /roads-rails/ that forward to /#map. amplify.yml 301s the old URLs to /.
KHD_ROADS_RAILS=1 npm run build (or npm run build:roads-rails) builds it all again and runs its checks.
To relaunch, set that variable in Amplify and remove the Roads & Rails block from amplify.yml. The tree as
it was live is on branch preserve/roads-and-rails and tag roads-and-rails-2026-10-19.
Develop
npm install
npm run dev
Content pipeline
- Save morning-brief plaintext to
public/content/raw-briefs/YYYY-MM-DD.md - Split into stories and rebuild the index:
npm run parse-briefs # scripts/parse-briefs-to-stories.mjs
# or just rebuild the index from existing story JSON:
npm run build-stories
Each brief section becomes one story JSON under public/content/stories/ with fields:
slug, title, publishedDate, summary, bodyMarkdown, yearStart, yearEnd,
era (prehistoric | native | frontier | early-commonwealth | other),
tags, source: "daily-brief", briefDate.
Google redirect URLs in brief bodies are cleaned to the underlying target when possible.
iOS app data feed (quiet URL)
The iPhone app checks data_version and downloads layer JSON from a path that is not in the main nav:
- https://kyhistorydrive.com/data/app/ky-history-manifest.json
- https://kyhistorydrive.com/data/app/ky-history.json
- plus the other bundled layer files (
museums.json,markers.phase1.json,search-index.json, …) under/data/app/
Source of truth is this repo’s committed public/data/app/, served at https://kyhistorydrive.com/data/app/. That pack is separate from the web map GeoJSON under public/data/layers/.
Daily content-only History bump
Edit History and the manifest in this repo only (public/data/app/ky-history.json and public/data/app/ky-history-manifest.json, including data_version). Commit and deploy here. Do not commit ky-markers-drive for a data_version bump alone.
npm run sync-app-data # validates committed public/data/app/; does not fetch
# QA fixes in scripts/story-overrides.json are re-applied after sync and in npm run build (see scripts/README.md)
# PR or push to main — Amplify deploys the committed files
Amplify preBuild runs sync-app-data, which validates and publishes the committed pack. It does not pull ky-markers-drive. Do not set SYNC_FROM_MARKERS on Amplify (a GitHub token on the build is not enough to pull, and must not be treated as a daily refresh).
npm run check-ota-types (scripts/check-ota-types.mjs) fails the build when public/data/app/ cannot decode on iOS builds 4 and 5. History marker_number must be a JSON integer or omitted (never null or a string). bio_url must be a non-empty string. Null URL keys are rejected. The check runs inside sync-app-data and npm run build. apply-story-overrides rewrites History entries to that shape so a pack rebuild does not put the drift back.
SYNC_FROM_MARKERS=1 is a legacy/migration override only. With that opt-in, KY_MARKERS_DRIVE_DIR or KY_MARKERS_DRIVE_GITHUB_TOKEN (also GH_TOKEN / GITHUB_TOKEN) can overwrite public/data/app/ from the iOS repo. Leave it unset for daily deploys.
customHttp.yml sets short CloudFront cache (max-age=0, s-maxage=60) and CORS (Access-Control-Allow-Origin: *) on /data/app/*.json so version bumps are not stuck behind Amplify’s default 1-year CDN cache. Native iOS URLSession does not need CORS; it is there for completeness. The same file is the only copy of the security headers, including a report-only Content-Security-Policy, and it serves /feed.xml as application/rss+xml. amplify.yml does not repeat the headers. It keeps the /about 301 with the other rewrites. See docs/SECURITY-HEADERS.md.
iOS App Store / TestFlight cut
When cutting an App Store or TestFlight build (Shannon/CoS-driven), copy the current OTA pack from this repo’s public/data/app/ into ky-markers-drive data/ as the offline fallback, then bump the iOS build. There is no push script. Do that copy only on a store cut, not for a daily data_version bump.
Advertising preview
Ad slots are off unless VITE_ADS_ENABLED is true or 1 at build time, or the URL has ?adpreview=1 (query before the hash, for example /?adpreview=1#timeline/some-story). ?adpreview=0 forces them off. With the flag off and no preview query, the page does not insert a slot and does not shift layout. The head already includes one adsbygoogle.js tag, and /ads.txt is already a static file. Slots reuse that tag and do not add a second copy. A slot inserts the script only when a unit id is set and the tag is missing, after first paint, and only once the slot is within about 300px of the viewport. There is no preload. A slot waits until a visible map has gone idle (or eight seconds) so the ad request does not compete with MapLibre tile loading.
The publisher id defaults to ca-pub-8587137224654033 (public). Override with VITE_ADSENSE_CLIENT. Unit ids are VITE_ADSENSE_SLOT_HOME, VITE_ADSENSE_SLOT_SIDEBAR, and VITE_ADSENSE_SLOT_EXPLORE. Until those are set, each slot is a same-size placeholder: one small Advertisement label and an empty reserved box. The always-on pages from this change are the footer Privacy link, /privacy, /robots.txt, and /sitemap.xml.
Placements, and nowhere else (not the map, popups, pin links, hero, or nav):
- Bottom of the homepage, after today’s stories and the rest of the home sections, above the footer.
- Bottom of the story photo sidebar on
/#timeline/<slug>, only when that story has the sidebar. Hidden at viewports 900px and narrower so it does not stack with another slot on a phone. The map layers panel and the Timeline places map are sidebars too, and they do not get a slot. - Bottom of Explore a layer, after the card list and clear of the pager, on page 2 and later only.
Each slot is labeled Advertisement and keeps a fixed min-height so a late or empty fill cannot collapse the page. In the AdSense account, leave Auto ads off, including anchor and vignette, so Google does not inject sticky or full-screen units.
Keep AdSense Auto ads OFF: the loader is on every page, so Auto ads would place ads on all stories.
/privacy is a real HTML page (not a hash route) linked from the footer. It covers Google and partner advertising cookies, links to How Google uses information from sites or apps that use our services, and explains opting out in Google Ads Settings. Consent for EEA, UK, and Swiss visitors, and the US state privacy message, come from AdSense Privacy & messaging (Google’s certified CMP for those regions). Publish that message before turning VITE_ADS_ENABLED on for production traffic.
/robots.txt allows all crawlers, including Mediapartners-Google, GPTBot, PerplexityBot, ClaudeBot, and Google-Extended, and points at /sitemap.xml. The sitemap lists the crawlable URLs (/ and /privacy). Hash routes are the same document and are not listed.
amplify.yml has no catch-all SPA rewrite. It rewrites /privacy and /privacy/ to /privacy/index.html (200). /robots.txt and /sitemap.xml are files in public/. If the Amplify console has a hosting rewrite to /index.html for extensionless paths, /privacy and /sitemap.xml (.xml is often not in the static-extension exclusion list) will be swallowed. Put the file-specific rules above that catch-all, or add xml to the exclusion list and exclude /privacy. Do not add a new catch-all.
Build
npm run build
npm run preview
npm run build regenerates public/content/stories.json then runs Vite. Output is in dist/ for Amplify.
AWS Amplify + Route53
- Amplify Hosting → Host web app → connect GitHub repo
shannonsnowden/kyhistorydrive - Build settings use root
amplify.yml(npm ci→npm run sync-app-data→npm run build, artifactdist).sync-app-datapublishes committedpublic/data/app/. Do not setSYNC_FROM_MARKERSon Amplify. Cache/CORS for/data/app/*.json, the/feed.xmlRSS content type, and the security headers are only incustomHttp.yml. - When kyhistorydrive.com is live in Route53, Amplify → Domain management → add
kyhistorydrive.com(+wwwif desired) - Amplify will ask for Route53 DNS records (or provide CNAME/ALIAS to paste into the hosted zone)
Set VITE_CARTO_API_KEY in Amplify Hosting → Environment variables (and locally in a gitignored .env), then redeploy. Without it, CARTO serves an “API key required” watermark. If you later switch to MapTiler/Stadia vector styles, also set VITE_MAP_STYLE_URL.
Magazine homepage (/)
/ is the magazine homepage: evergreen Kentucky history highlights (no “this morning” / calendar-date kickers). Map stays one click away at /#map. Old /home-preview URLs redirect or alias to /.
Daily story highlights come from the same KY History morning brief that feeds Timeline:
- Save the email as
public/content/raw-briefs/YYYY-MM-DD.md npm run parse-briefswritespublic/content/stories/<slug>.jsonand rebuildsstories.jsonnpm run build-home-preview(also part ofnpm run build/ Amplify) reads the newestbriefDate, keeps morning-email order, attaches attributed photos (Wikipedia, Wikimedia Commons, orhistoric-photos.json), and writespublic/content/home-preview.json
The homepage loads that pack, then re-checks stories.json in the browser. If a newer briefDate is already live, it fetches those story files and Wikipedia thumbnails so the homepage can update on the same deploy even if the pack step was skipped. If the latest feed is empty, the last baked pack is the fallback.
Stories are presented as evergreen highlights. The feed still refreshes from the newest briefDate; the UI does not label them as “this morning’s email” or show the ingest calendar date.
Photos are credited on the page (Wikipedia / Commons / ULPA / Historypin, etc.). Layer highlight cards use curated Commons / HABS-LOC thumbs vendored under public/content/photos/layers/ (catalog: scripts/layer-photo-curated.json) so every “Explore a layer” card has a same-origin thumbnail plus a map deep-link — not a Wikimedia hotlink or a text-only fallback. Daily highlights use the same pattern under public/content/photos/stories/ (scripts/story-photo-curated.json).
Explore a layer (magazine pages)
The homepage “Explore a layer” section (src/explore-layer.js) is a paged magazine. Tabs: On the map (the 12 curated layer stops) plus one tab per story era (Prehistoric / Native / Frontier / Early commonwealth / Other). Every story in stories.json that has a same-origin curated photo + credit in story-photos.json is listed exactly once (56 today); new stories appear automatically when their photo is added. Page size is fixed per breakpoint (6 desktop ≥1000px, 4 tablet ≥620px, 3 mobile) with a fixed card height so the page never jumps. URL: #explore/<tab>/<page>. Prev/Next, numbered pages, ←/→ keys, swipe, Home button on every page bar.
Data attribution
Marker inscriptions and locations: Kentucky Historical Society / history.ky.gov. Map data: © OpenStreetMap contributors; CARTO; OpenHistoricalMap when enabled. Morning-brief stories are authored for the KY History Drive project.
Related
- iOS app repo: https://github.com/shannonsnowden/ky-markers-drive