Repository navigation
feat(site): serve course lessons at /learn/<phase>/<lesson> - #780
Conversation
Course lessons get a path URL built from the phase and lesson directory names without their number prefixes, for example /learn/transformers-deep-dive/self-attention-from-scratch. The lesson handler resolves the clean path through the lesson manifest, keeps language and navigation context as query parameters, and answers 308 from /lesson?path=phases/... to the clean URL. Certification lessons keep the query form. Canonical tags, hreflang alternates, sitemaps, llms.txt, social card paths, and the practice, interview, cheat sheet, and phase hub links use the clean URL. The API docs and OpenAPI description list the new route. On a clean URL the page sets a base href and a lesson path meta tag. The reader, the language picker, and the highlight export read the lesson path from that tag, and the shared header rewrites lesson links to the clean form outside static previews.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 37 seconds. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…own names The host adds rewrite path parameters to the request query. The route used `phase` and `lesson`, which the lesson handler treats as unknown query names, so a clean URL answered 308 to itself on the preview. The parameters are now `cleanPhase` and `cleanLesson`, the names the handler already accepts on a clean request.
… URLs Narration treats /learn/<phase>/<lesson> links as lesson continuation, and its route key maps the query form of a course lesson to the clean form, so playback continues when a link goes through the redirect. The fragment link handler leaves modified and non-primary clicks to the browser.
…smoke test On a clean lesson URL, an in-page link gets the current path and query in front of its fragment as soon as the reader points at, focuses, or opens a menu on it. Copy link, open in new tab, and modified clicks then stay on the lesson. The table of contents and scroll handlers read the fragment from either form and leave modified clicks to the browser. The function bundle smoke test requests each lesson at its canonical URL. It asked for a course lesson by the query form and got the redirect.
…n lesson URLs The agent readiness test expects course lessons at /learn/ in the lesson manifest and the sitemap, checks that no two course lessons share a clean URL, and keeps the query form for certification lessons. Book chapters link to the clean lesson URL.
What changes
URL form
/learn/<phase>/<lesson>. Each segment is the directory name without its number prefix:phases/07-transformers-deep-dive/02-self-attention-from-scratchbecomes/learn/transformers-deep-dive/self-attention-from-scratch.?lang=hi,?learningPath=...,?fromTrack=..../lesson?path=certifications/....Redirects
/lesson?path=phases/...and/lesson.html?path=phases/...answer 308 to the clean URL and keep valid context parameters.Server
vercel.jsonrewrites/learn/:phase/:lessonto the lesson function.api/lesson.jsresolves the clean path through the lesson manifest. It reads the path fromreq.url, and from the rewrite parameters when the host passes the destination URL.og:url, hreflang alternates, sitemaps,llms.txt,lesson-seo.json, and social card paths use the clean URL.site/developer.md,site/developer.html, andsite/openapi.jsondocument the new route.Client
<base href="/">and<meta name="aifs-lesson-path">. The lesson reader, the language picker, and the highlight export read the lesson path from the meta tag when the query has none.header.jsrewriteslesson?path=phases/...links to the clean form outside static previews. Static previews keep the query form.Not changed
lesson?path=links (catalog fallback table, skills page) keeps them for static previews. The header rewrites them in the browser, and a request without JavaScript follows one redirect.Tests
scripts/test_seo_routes.js,scripts/test_api_state.js,scripts/test_agent_api.js,scripts/test_agent_wire.js, and six site test files updated to the new contract. Legacy route tests now assert the 308 and its exact Location.node --test scripts/test_*.js site/test_*.js: 737 pass, 2 fail.mainata509402c0. fix(cheatsheets): add tool-contract-migration-checker to a cheat sheet topic #781 fixes it.scripts/test_function_bundles.jspasses with@vercel/nftinstalled. An earlier commit on this branch failed it in CI: the smoke test asked for a course lesson by the query form. It now requests the canonical URL.Checked locally
To check on the preview
The first three were checked on the preview of
715c91259with authenticated requests. The first preview answered 308 from the clean URL to itself, because the host adds rewrite path parameters to the query under their route names. The route parameters are nowcleanPhaseandcleanLesson, and a test covers each request shape. The browser items below are not checked on the preview yet./learn/transformers-deep-dive/self-attention-from-scratchanswers 200 with the clean canonical/lesson?path=phases/07-transformers-deep-dive/02-self-attention-from-scratchanswers 308 to it/learn/transformers-deep-dive/self-attention-from-scratch?lang=hirenders the translationRisk