diff --git a/_components/PostListItem.tsx b/_components/PostListItem.tsx
index 06a4098..a339e9b 100644
--- a/_components/PostListItem.tsx
+++ b/_components/PostListItem.tsx
@@ -1,24 +1,20 @@
-interface Props {
- post: any;
-}
-
-export default function (props: Props) {
+export default function (data: Lume.Data) {
return (
@@ -32,9 +22,17 @@ export default function ({ nav, comp }) {
return (
- {nav.menu("/blog/posts").children.sort(sortPosts).map((post, index) => (
-
- ))}
+ {nav.menu("/blog/posts")?.children?.sort((a, b) => {
+ let result = 0;
+ if (a.data && b.data) {
+ if (a.data.date < b.data.date) {
+ result = 1;
+ } else if (a.data.date > b.data.date) {
+ result = -1;
+ }
+ }
+ return result;
+ }).map((post, index) => )}
);
}
diff --git a/deno.json b/deno.json
index b70aae6..cd8fbd9 100644
--- a/deno.json
+++ b/deno.json
@@ -2,21 +2,22 @@
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "npm:react",
+ "jsxImportSourceTypes": "npm:@types/react",
"types": [
- "https://unpkg.com/@types/react@18.2.37/index.d.ts",
"lume/types.ts"
]
},
"tasks": {
"lume": "echo \"import 'lume/cli.ts'\" | deno run --allow-write='.' --allow-read='.' --allow-net='deno.land,cdn.deno.land,esm.sh,0.0.0.0:3000,jsr.io,lumeland.github.io' --allow-sys=networkInterfaces --allow-env='LUME_ENV,LUME_LIVE_RELOAD,LUME_LOGS,LUME_NOCACHE,LUME_DRAFTS' -",
"build": "deno task lume",
- "check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
+ "check": "deno fmt --check && deno lint && deno check .",
"serve": "deno task lume -s",
"deploy": "rsync -avh --progress --delete ./_site/ podman:/srv/www/fosterhangdaan.com/"
},
"imports": {
"react/jsx-runtime": "https://esm.sh/react@18.2.0/jsx-runtime",
- "lume/": "https://deno.land/x/lume@v2.2.4/"
+ "lume/": "https://deno.land/x/lume@v2.2.4/",
+ "lume-markdown-plugins/": "https://deno.land/x/lume_markdown_plugins@v0.7.1/"
},
"fmt": {
"exclude": [
diff --git a/deno.lock b/deno.lock
index 92fc9c6..8d43b00 100644
Binary files a/deno.lock and b/deno.lock differ
diff --git a/index.tsx b/index.tsx
index 504acef..68a72c7 100644
--- a/index.tsx
+++ b/index.tsx
@@ -1,16 +1,6 @@
export const description = "Software developer and open-source enthusiast.";
-export default function ({ nav }) {
- const sortPosts = (a, b) => {
- if (a.data.date < b.data.date) {
- return 1;
- } else if (a.data.date > b.data.date) {
- return -1;
- } else {
- return 0;
- }
- };
-
+export default function (data: Lume.Data) {
return (
<>
@@ -24,7 +14,7 @@ export default function ({ nav }) {
times, I help in the battle for an open web and for user privacy by
contributing in the development of free and open-source software.
-
@@ -35,7 +25,7 @@ export default function ({ nav }) {
If you'd like an encrypted response, you can send me your GPG public
key. You can find mine in the GPG Key page.
-
+
Highlighted Projects
@@ -78,21 +68,31 @@ export default function ({ nav }) {
View all projects
-
+
Latest Blog Posts
- {nav.menu("/blog/posts").children.sort(sortPosts).slice(0, 5).map((
+ {data.nav.menu("/blog/posts")?.children?.sort((a, b) => {
+ let result = 0;
+ if (a.data && b.data) {
+ if (a.data.date < b.data.date) {
+ result = 1;
+ } else if (a.data.date > b.data.date) {
+ result = -1;
+ }
+ }
+ return result;
+ }).slice(0, 5).map((
post,
index,
) => (
- {post.data.title} —{" "}
+ {post.data?.title} —{" "}
{Intl.DateTimeFormat("en-CA", { dateStyle: "long" }).format(
- post.data.date,
+ post.data?.date,
)}