Skip to content

Commit ab7f9f7

Browse files
brabojclaude
andauthored
fix: address P1 and P2 issues from code review (#215)
* fix: address P1 and P2 issues from code review - Remove set:html XSS risk in Footer (#208) - Fix hardcoded JSON-LD URLs to use Astro.site (#209) - Fix dark mode link contrast for WCAG AAA (#210) - Remove unused search box CSS (#211) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add custom 404 page Branded error page with header, footer, and link back to tutorial home. Includes noindex meta tag and dark mode support. Closes #212 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ddea358 commit ab7f9f7

5 files changed

Lines changed: 40 additions & 43 deletions

File tree

astro-site/src/components/Footer.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import site from "../data/site.json";
33
---
44

55
<footer class="site-footer">
6-
<Fragment set:html={site.copyright} />
6+
{site.copyright}
77
</footer>

astro-site/src/pages/404.astro

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
import "../styles/global.css";
3+
import Header from "../components/Header.astro";
4+
import Footer from "../components/Footer.astro";
5+
import site from "../data/site.json";
6+
7+
const base = import.meta.env.BASE_URL;
8+
---
9+
10+
<!doctype html>
11+
<html lang="en">
12+
<head>
13+
<meta charset="utf-8" />
14+
<meta name="viewport" content="width=device-width, initial-scale=1" />
15+
<title>Page Not Found — {site.title}</title>
16+
<meta name="robots" content="noindex" />
17+
<script is:inline>
18+
document.documentElement.setAttribute(
19+
"data-theme",
20+
localStorage.getItem("theme") || "light"
21+
);
22+
</script>
23+
</head>
24+
<body>
25+
<Header currentPath="/" />
26+
<main class="content" style="text-align: center; padding: 4rem 1rem;">
27+
<h1>404 — Page Not Found</h1>
28+
<p style="margin: 1rem 0 2rem; color: var(--color-fg-muted);">
29+
The page you're looking for doesn't exist or has been moved.
30+
</p>
31+
<a href={base} style="color: var(--color-link);">Back to the tutorial</a>
32+
</main>
33+
<Footer />
34+
</body>
35+
</html>

astro-site/src/pages/[...slug].astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const jsonLd = {
3737
"isPartOf": {
3838
"@type": "Course",
3939
"name": "Git Tutorial — Code with Branko",
40-
"url": "https://braboj.github.io/tutorial-git/"
40+
"url": new URL(import.meta.env.BASE_URL, import.meta.env.SITE).toString()
4141
}
4242
};
4343
---

astro-site/src/pages/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const jsonLd = {
1616
"@type": "Course",
1717
"name": "Git Tutorial — Code with Branko",
1818
"description": "A hands-on Git tutorial from first commit to confident daily use — concepts, exercises, and real-world examples.",
19-
"url": "https://braboj.github.io/tutorial-git/",
19+
"url": new URL(import.meta.env.BASE_URL, import.meta.env.SITE).toString(),
2020
"provider": {
2121
"@type": "Person",
2222
"name": "Branimir Georgiev",

astro-site/src/styles/global.css

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
--color-fg-muted: #aaaaaa;
5656
--color-fg-faint: #888888;
5757
--color-border: #ffffff1f;
58-
--color-link: #4dd0e1;
59-
--color-focus: #4dd0e1;
58+
--color-link: #00bcd4;
59+
--color-focus: #00bcd4;
6060
--color-code-bg: #2a2a2a;
6161
--color-code-fg: #e0e0e0;
6262
}
@@ -169,44 +169,6 @@ a:hover {
169169
gap: var(--space-sm);
170170
}
171171

172-
/* Search box */
173-
.search-box {
174-
position: relative;
175-
display: flex;
176-
align-items: center;
177-
}
178-
179-
.search-icon {
180-
position: absolute;
181-
left: 0.5rem;
182-
color: #fff;
183-
opacity: 0.7;
184-
pointer-events: none;
185-
}
186-
187-
.search-box input {
188-
background: rgba(255, 255, 255, 0.15);
189-
border: none;
190-
border-radius: 3px;
191-
color: #fff;
192-
font-family: var(--font-text);
193-
font-size: var(--font-size-sm);
194-
padding: 0.35rem 0.5rem 0.35rem 2rem;
195-
width: 10rem;
196-
transition: background 0.2s, width 0.2s;
197-
}
198-
199-
.search-box input::placeholder {
200-
color: rgba(255, 255, 255, 0.7);
201-
}
202-
203-
.search-box input:focus-visible {
204-
background: rgba(255, 255, 255, 0.25);
205-
width: 14rem;
206-
outline: 2px solid #fff;
207-
outline-offset: 1px;
208-
}
209-
210172
/* Theme toggle */
211173
.theme-toggle {
212174
background: none;

0 commit comments

Comments
 (0)