Skip to content

Commit

Permalink
remove most articles. Use a dynamic route to handle all article pages
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanLi committed Dec 23, 2024
1 parent dc99e41 commit 36948c8
Show file tree
Hide file tree
Showing 59 changed files with 61 additions and 2,618 deletions.
36 changes: 36 additions & 0 deletions app/(blog)/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { Metadata } from 'next'
import { notFound } from 'next/navigation'

import { Article } from '../components/article/Article'
import { getArticle } from '../utils'

type Props = {
params: Promise<{ slug: string }>
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
const slug = (await params).slug

try {
const article = await getArticle(slug)

return {
title: article.title,
description: article.teaser,
}
} catch {
notFound()
}
}

export default async function Page({ params }: Props) {
const slug = (await params).slug

try {
const article = await getArticle(slug)

return <Article {...article} />
} catch {
notFound()
}
}
280 changes: 0 additions & 280 deletions app/(blog)/accounting-software-shortcomings/article.tsx

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions app/(blog)/accounting-software-shortcomings/page.tsx

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions app/(blog)/accounting-software-shortcomings/shortcomings.jpg

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions app/(blog)/accounting-software-shortcomings/taxesConfused.jpg

This file was deleted.

Loading

0 comments on commit 36948c8

Please sign in to comment.