Skip to content

Commit 3e0cac8

Browse files
committed
fix flash of content
1 parent 60430cc commit 3e0cac8

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

pages/about.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import mePresenting from "../public/assets/presenting-high-res.jpg";
44
import Image from "next/image";
55
import Layout from "../components/layout";
66
import Link from "next/link";
7+
import ms from "ms";
78

8-
export default function About() {
9-
const daysSince1stJan2019 = Math.floor((new Date().getTime() - new Date("2019-01-01").getTime()) / (1000 * 60 * 60 * 24));
9+
export default function About({ daysSince }: { daysSince: number }) {
1010
return (
1111
<Layout title="About" description="About me.">
1212
<h1>About</h1>
1313
<main>
1414
<p>
1515
I write software and write about software. My research interests include programming language design, compilers, puzzle/game solvers, and distributed systems.</p>
1616
<p>
17-
This <a href={siteConfig.REPO_URL}>open source</a> website is built with Next.js and is {daysSince1stJan2019} days old – some of the development is covered in <Link href="/notes">my notes</Link>. The very first version was built with Jekyll.
17+
This <a href={siteConfig.REPO_URL}>open source</a> website is built with Next.js and is {daysSince} days old – some of the development is covered in <Link href="/notes">my notes</Link>. The very first version was built with Jekyll.
1818
</p>
1919
<p>
2020
Feel free to <a href="mailto:[email protected]">email me</a> with any questions or comments.
@@ -49,3 +49,13 @@ export default function About() {
4949
</Layout>
5050
);
5151
}
52+
53+
export async function getStaticProps() {
54+
const startDate = new Date("2019-01-01");
55+
const daysSince = Math.floor((new Date().getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24));
56+
57+
return {
58+
props: { daysSince },
59+
revalidate: ms('1d') / 1000
60+
}
61+
}

pages/projects.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ export async function getStaticProps() {
8686
totalStars,
8787
mostRecentPushFormatted,
8888
},
89-
revalidate: ms('30min') / 1000, // TIL this is seconds
89+
revalidate: ms('30min') / 1000,
9090
}
9191
}

0 commit comments

Comments
 (0)