Skip to content

Commit 0a499da

Browse files
committed
Add hidden resume redirect
1 parent f0dcd86 commit 0a499da

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

_tests/resume-route.test.mjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import assert from "node:assert/strict";
2+
import { readFile } from "node:fs/promises";
3+
import test from "node:test";
4+
5+
const root = new URL("../", import.meta.url);
6+
7+
test("the hidden resume route redirects to the published resume", async () => {
8+
const [route, header, sitemap] = await Promise.all([
9+
readFile(new URL("resume/index.html", root), "utf8"),
10+
readFile(new URL("_includes/header.html", root), "utf8"),
11+
readFile(new URL("sitemap.xml", root), "utf8")
12+
]);
13+
14+
assert.match(route, /^---\npermalink: \/resume\/\n---/);
15+
assert.match(
16+
route,
17+
/window\.location\.replace\(destination\.href\)/
18+
);
19+
assert.ok(route.includes("https://frankstop.github.io/Resume/"));
20+
assert.ok(!header.includes("/resume"));
21+
assert.ok(!sitemap.includes("/resume"));
22+
});

resume/index.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
permalink: /resume/
3+
---
4+
<!DOCTYPE html>
5+
<html lang="en">
6+
<head>
7+
<meta charset="utf-8">
8+
<meta name="viewport" content="width=device-width, initial-scale=1">
9+
<meta name="robots" content="noindex">
10+
<meta http-equiv="refresh" content="0; url=https://frankstop.github.io/Resume/">
11+
<link rel="canonical" href="https://frankstop.github.io/Resume/">
12+
<title>Frank Valdez Resume</title>
13+
<script>
14+
(function () {
15+
const destination = new URL("https://frankstop.github.io/Resume/");
16+
destination.search = window.location.search;
17+
destination.hash = window.location.hash;
18+
window.location.replace(destination.href);
19+
}());
20+
</script>
21+
</head>
22+
<body>
23+
<p>
24+
Redirecting to
25+
<a href="https://frankstop.github.io/Resume/">Frank Valdez’s resume</a>.
26+
</p>
27+
</body>
28+
</html>

0 commit comments

Comments
 (0)