diff --git a/pages/about.html b/pages/about.html
new file mode 100644
index 0000000..1fa5293
--- /dev/null
+++ b/pages/about.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+ top about
+
+
+ Top Level About
+
+
diff --git a/pages/about/index.html b/pages/about/index.html
new file mode 100644
index 0000000..3c8c9e6
--- /dev/null
+++ b/pages/about/index.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+ About Me
+
+
+ About Me
+
+
diff --git a/pages/about/me.html b/pages/about/me.html
new file mode 100644
index 0000000..2a8fef3
--- /dev/null
+++ b/pages/about/me.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+ About Meeeee
+
+
+ About Meeeeeezzz
+
+
diff --git a/routes/[...index].ts b/routes/[...index].ts
index 7e3bb5b..59f006b 100644
--- a/routes/[...index].ts
+++ b/routes/[...index].ts
@@ -1,7 +1,22 @@
import * as fs from "fs";
export default eventHandler((event) => {
const filename = event.path === "/" ? "/index.html" : `${event.path}.html`;
- const path = `./src/pages${filename}`;
- const html = fs.readFileSync(path, "utf8");
+ const fallback = getPath(event.path + "/index.html");
+ const path = getPath(filename);
+ let html = "";
+ try {
+ html = fs.readFileSync(path, "utf8");
+ } catch (error) {
+ try {
+ html = fs.readFileSync(fallback, "utf8");
+ } catch {
+ html = `cannot find ${path} or ${fallback}`;
+ }
+ }
+
return html;
});
+
+function getPath(filename: string) {
+ return `./pages${filename}`;
+}