fix(*): corrects a number of html validation issues

This commit is contained in:
Cory Dransfeldt 2025-05-16 10:54:27 -07:00
parent 81e738621c
commit 48f527ab82
No known key found for this signature in database
6 changed files with 27 additions and 14 deletions

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "coryd.dev", "name": "coryd.dev",
"version": "5.1.5", "version": "5.1.6",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "coryd.dev", "name": "coryd.dev",
"version": "5.1.5", "version": "5.1.6",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"html-minifier-terser": "7.2.0", "html-minifier-terser": "7.2.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "coryd.dev", "name": "coryd.dev",
"version": "5.1.5", "version": "5.1.6",
"description": "The source for my personal site. Built using 11ty (and other tools).", "description": "The source for my personal site. Built using 11ty (and other tools).",
"type": "module", "type": "module",
"engines": { "engines": {

View file

@ -22,6 +22,5 @@ const fetchTopTags = async () => {
}; };
export default async function () { export default async function () {
console.log(await fetchTopTags())
return await fetchTopTags(); return await fetchTopTags();
} }

View file

@ -1 +1 @@
<p><mark>{{ label }}</mark>{%- for tag in tags %} <a href="/tags/{{ tag.tag }}">#{{ tag.tag }}</a>{%- endfor -%}</p> <p><mark>{{ label }}</mark>{%- for tag in tags %} <a href="/tags/{{ tag.tag | url_encode }}">#{{ tag.tag }}</a>{%- endfor -%}</p>

View file

@ -14,22 +14,34 @@
$filePath = __DIR__ . "/years/{$year}.html"; $filePath = __DIR__ . "/years/{$year}.html";
if (file_exists($filePath)) { if (file_exists($filePath)) {
echo file_get_contents($filePath); readfile($filePath);
exit();
} else { } else {
echo file_get_contents(__DIR__ . "/../404/index.html"); http_response_code(404);
header("Content-Type: text/html; charset=utf-8");
readfile(__DIR__ . "/../404/index.html");
exit(); exit();
} }
exit();
} }
if ($url === "books/years" || $url === "books") { if ($url === "books") {
$indexPath = $url === "books" ? "index.html" : __DIR__ . "/../404/index.html"; http_response_code(200);
readfile($indexPath); header("Content-Type: text/html; charset=utf-8");
readfile(__DIR__ . "/index.html");
exit();
}
if ($url === "books/years") {
http_response_code(404);
header("Content-Type: text/html; charset=utf-8");
readfile(__DIR__ . "/../404/index.html");
exit(); exit();
} }
if (!preg_match('/^books\/[\w-]+$/', $url)) { if (!preg_match('/^books\/[\w-]+$/', $url)) {
echo file_get_contents(__DIR__ . "/../404/index.html"); http_response_code(404);
header("Content-Type: text/html; charset=utf-8");
readfile(__DIR__ . "/../404/index.html");
exit(); exit();
} }
@ -37,7 +49,9 @@
$book = $fetcher->fetch($url); $book = $fetcher->fetch($url);
if (!$book) { if (!$book) {
echo file_get_contents(__DIR__ . "/../404/index.html"); http_response_code(404);
header("Content-Type: text/html; charset=utf-8");
readfile(__DIR__ . "/../404/index.html");
exit(); exit();
} }

View file

@ -22,7 +22,7 @@
<span class="subheader">{{ item.chart.subtext }}</span> <span class="subheader">{{ item.chart.subtext }}</span>
</div> </div>
</div> </div>
<time datetime="{{ item.chart.played_at }}"> <time datetime="{{ item.chart.played_at | date: "%Y-%m-%dT%H:%M:%S%:z", "America/Los_Angeles" }}">
{{ item.chart.played_at | date:"%B %-d, %-I:%M%p", "America/Los_Angeles" }} {{ item.chart.played_at | date:"%B %-d, %-I:%M%p", "America/Los_Angeles" }}
</time> </time>
</div> </div>