-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab16718
commit bc50c40
Showing
18 changed files
with
1,518 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
title: "Hello World" | ||
publishedAt: "2024-06-18" | ||
summary: "My first post on my new blog." | ||
--- | ||
|
||
Hi there! | ||
|
||
```jsx | ||
console.log("Hello World"); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
}; | ||
|
||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { getPost } from "@/data/blog"; | ||
import { DATA } from "@/data/resume"; | ||
import { formatDate } from "@/lib/utils"; | ||
import type { Metadata } from "next"; | ||
import { notFound } from "next/navigation"; | ||
import { Suspense } from "react"; | ||
|
||
export async function generateMetadata({ | ||
params, | ||
}: { | ||
params: { | ||
slug: string; | ||
}; | ||
}): Promise<Metadata | undefined> { | ||
let post = await getPost(params.slug); | ||
|
||
let { | ||
title, | ||
publishedAt: publishedTime, | ||
summary: description, | ||
image, | ||
} = post.metadata; | ||
let ogImage = image ? `${DATA.url}${image}` : `${DATA.url}/og?title=${title}`; | ||
|
||
return { | ||
title, | ||
description, | ||
openGraph: { | ||
title, | ||
description, | ||
type: "article", | ||
publishedTime, | ||
url: `${DATA.url}/blog/${post.slug}`, | ||
images: [ | ||
{ | ||
url: ogImage, | ||
}, | ||
], | ||
}, | ||
twitter: { | ||
card: "summary_large_image", | ||
title, | ||
description, | ||
images: [ogImage], | ||
}, | ||
}; | ||
} | ||
|
||
export default async function Blog({ | ||
params, | ||
}: { | ||
params: { | ||
slug: string; | ||
}; | ||
}) { | ||
let post = await getPost(params.slug); | ||
|
||
if (!post) { | ||
notFound(); | ||
} | ||
|
||
return ( | ||
<section id="blog"> | ||
<script | ||
type="application/ld+json" | ||
suppressHydrationWarning | ||
dangerouslySetInnerHTML={{ | ||
__html: JSON.stringify({ | ||
"@context": "https://schema.org", | ||
"@type": "BlogPosting", | ||
headline: post.metadata.title, | ||
datePublished: post.metadata.publishedAt, | ||
dateModified: post.metadata.publishedAt, | ||
description: post.metadata.summary, | ||
image: post.metadata.image | ||
? `${DATA.url}${post.metadata.image}` | ||
: `${DATA.url}/og?title=${post.metadata.title}`, | ||
url: `${DATA.url}/blog/${post.slug}`, | ||
author: { | ||
"@type": "Person", | ||
name: DATA.name, | ||
}, | ||
}), | ||
}} | ||
/> | ||
<h1 className="title font-medium text-2xl tracking-tighter max-w-[650px]"> | ||
{post.metadata.title} | ||
</h1> | ||
<div className="flex justify-between items-center mt-2 mb-8 text-sm max-w-[650px]"> | ||
<Suspense fallback={<p className="h-5" />}> | ||
<p className="text-sm text-neutral-600 dark:text-neutral-400"> | ||
{formatDate(post.metadata.publishedAt)} | ||
</p> | ||
</Suspense> | ||
</div> | ||
<article | ||
className="prose dark:prose-invert" | ||
dangerouslySetInnerHTML={{ __html: post.source }} | ||
></article> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import BlurFade from "@/components/magicui/blur-fade"; | ||
import { getBlogPosts } from "@/data/blog"; | ||
import Link from "next/link"; | ||
|
||
export const metadata = { | ||
title: "Blog", | ||
description: "My thoughts on software development, life, and more.", | ||
}; | ||
|
||
const BLUR_FADE_DELAY = 0.04; | ||
|
||
export default async function BlogPage() { | ||
const posts = await getBlogPosts(); | ||
|
||
return ( | ||
<section> | ||
<BlurFade delay={BLUR_FADE_DELAY}> | ||
<h1 className="font-medium text-2xl mb-8 tracking-tighter">blog</h1> | ||
</BlurFade> | ||
{posts | ||
.sort((a, b) => { | ||
if ( | ||
new Date(a.metadata.publishedAt) > new Date(b.metadata.publishedAt) | ||
) { | ||
return -1; | ||
} | ||
return 1; | ||
}) | ||
.map((post, id) => ( | ||
<BlurFade delay={BLUR_FADE_DELAY * 2 + id * 0.05} key={post.slug}> | ||
<Link | ||
className="flex flex-col space-y-1 mb-4" | ||
href={`/blog/${post.slug}`} | ||
> | ||
<div className="w-full flex flex-col"> | ||
<p className="tracking-tight">{post.metadata.title}</p> | ||
<p className="h-6 text-xs text-muted-foreground"> | ||
{post.metadata.publishedAt} | ||
</p> | ||
</div> | ||
</Link> | ||
</BlurFade> | ||
))} | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.