Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ function renderHome() {
};
}

function renderNotFound(id) {
document.title = 'Lesson not found · Rust for Pythonistas';
main.innerHTML = `
<section class="hero">
<h1>Lesson not found</h1>
<p class="lead">There is no lesson at <code>#/${esc(id)}</code>.</p>
<p><a class="button primary" href="#/">← Back to the start page</a></p>
</section>`;
}

const reportLink = (l, where) => {
const n = LESSONS.indexOf(l) + 1;
const body = `**Lesson:** ${n}. ${l.title} (${SITE}#/${l.id})\n\n**Where and what:** ${where}: \n\n**What it should say instead** (optional):\n`;
Expand Down Expand Up @@ -585,7 +595,8 @@ function route() {
if (id === 'phrasebook') renderPhrasebook();
else if (page === 'errors') renderErrors(sub);
else if (id === 'review') renderReview();
else if (i < 0) renderHome();
else if (!id) renderHome();
else if (i < 0) renderNotFound(id);
else renderLesson(i);
renderNav();
document.body.classList.remove('nav-open');
Expand Down
2 changes: 2 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ h3.part { margin: 28px 0 0; color: var(--accent); font-size: 0.85rem; text-trans
.site-foot { margin-left: 270px; padding: 20px 40px 40px; max-width: 1180px; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--border); }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--accent); }
/* Vertical padding on inline links enlarges the tap target to 24px without moving the text. */
.why a, .how a, .tools-line a, .site-foot a, .nav-foot .links a { padding-block: 4px; }
.hero .button + .button { margin-left: 8px; }
@media (max-width: 860px) { .site-foot { margin-left: 0; padding: 20px 16px 32px; } }
.topbar #menu { white-space: nowrap; }
Expand Down
Loading