diff --git a/app/blog/[slug]/page.tsx b/app/blog/[slug]/page.tsx deleted file mode 100644 index 56dd595..0000000 --- a/app/blog/[slug]/page.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import getPostMetadata from '@/components/getPostMetadata'; -import fs from 'fs'; -import matter from 'gray-matter'; -import Markdown from 'markdown-to-jsx'; -import type { Metadata } from 'next'; - -const getPostContent = (slug: string) => { - const folder = 'posts/'; - const file = `${folder}${slug}.md`; - const content = fs.readFileSync(file, 'utf8'); - const matterResult = matter(content); - return matterResult; -}; - -export const generateStaticParams = async () => { - const posts = getPostMetadata(); - return posts.map((post) => ({ - slug: post.slug, - })); -}; - -export async function generateMetadata( - props: any -): Promise { - const posts = getPostMetadata(); - const post = posts.find((post) => post.slug === props.slug); - if (!post) { - return; - } - - const { title, subtitle: description, date: publishedTime, slug } = post; - - return { - title, - description, - openGraph: { - title, - description, - type: 'article', - publishedTime, - url: `https://hgonzaga.com/blog/${slug}`, - }, - }; -} - -const PostPage = (props: any) => { - const slug = props.params.slug; - const post = getPostContent(slug); - - return ( -
-

- {post.data.title} -

-

{post.data.subtitle}

- -
-
- {post.data.date} -
-
-
- -
- {post.content} -
-
- ); -}; - -export default PostPage; diff --git a/app/blog/page.tsx b/app/blog/page.tsx deleted file mode 100644 index 6bd28dd..0000000 --- a/app/blog/page.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import PostPreview from '@/components/PostPreview'; -import getPostMetadata from '@/components/getPostMetadata'; -import { Metadata } from 'next'; - -export const metadata: Metadata = { - title: 'Blog', - description: 'A space for my thoughts on it world, and more.', -}; - -const BlogPage = () => { - const postMetadata = getPostMetadata(); - const postPreview = postMetadata.map((post) => ( - - )); - - return ( -
-

Blog

-
{postPreview}
-
- ); -}; - -export default BlogPage; diff --git a/components/NavBar.tsx b/components/NavBar.tsx index ef6523e..c58c252 100644 --- a/components/NavBar.tsx +++ b/components/NavBar.tsx @@ -12,16 +12,10 @@ const navItems = { '/about': { name: 'about', }, - '/blog': { - name: 'blog', - }, }; const Navbar = () => { let pathname = usePathname() || '/'; - if (pathname.includes('/blog/')) { - pathname = '/blog'; - } return (