blog.hangerthem.com/components/post/RecentlyUpdatedPosts.tsx
HangerThem 89a0566feb fix: tag/category routes, recently updated list, feed and no-js flash
- Slugify tag/category static params so pre-rendered pages match links;
  disable dynamic params and return a real 404 via notFound()
- Drop bogus generateStaticParams from the tags/categories index pages
- Add a styled not-found page
- Sort 'Recently updated' by last modification before slicing
- Atom feed: correct rel=self URL, use updated dates, valid content type
- Swap no-js -> js class in an inline head script before first paint
- Markdown links: only route internal paths through next/link and
  tolerate missing hrefs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 14:15:57 +02:00

26 lines
855 B
TypeScript

import { getAllPostsMeta } from '@/lib/posts'
import Link from 'next/link'
export function RecentlyUpdatedPosts() {
const posts = getAllPostsMeta()
.toSorted(
(a, b) => new Date(b.updated ?? b.date).getTime() - new Date(a.updated ?? a.date).getTime(),
)
.slice(0, 5)
return (
<aside className="w-80 2xl:w-100 hidden lg:block">
<div className="sticky top-12 border-l border-border h-fit pl-4 py-4">
<h2 className="text-xl font-bold mb-4">Recently updated</h2>
<ul className="flex flex-col gap-2 ml-1">
{posts.map((post) => (
<li key={post.slug} className="text-sm text-fg-dim">
<Link href={`/posts/${post.slug}`} className="hover:underline">
{post.title}
</Link>
</li>
))}
</ul>
</div>
</aside>
)
}