diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2026-01-30 20:45:07 +0100 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2026-01-30 20:45:07 +0100 |
| commit | 650249e1a8fe7d6645bb712026930dd7e8906ef8 (patch) | |
| tree | 4a4f5c46c72f7b8b0f6bef21ce6938e8a8978084 /src/layouts/BlogPost.astro | |
| parent | 2345a208663efff76837d1228bf14b8847f3177f (diff) | |
feat(blog): add next/previous post navigation scoped by category
Navigate between posts within the same category (regular, microblog,
archived). Newer post links left, older post links right. Includes
i18n support for English and Polish.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/layouts/BlogPost.astro')
| -rw-r--r-- | src/layouts/BlogPost.astro | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/layouts/BlogPost.astro b/src/layouts/BlogPost.astro index 764cd80..73f994b 100644 --- a/src/layouts/BlogPost.astro +++ b/src/layouts/BlogPost.astro @@ -2,15 +2,18 @@ import type { CollectionEntry } from "astro:content"; import Masthead from "@/components/blog/Masthead.astro"; +import PostNavigation from "@/components/blog/PostNavigation.astro"; import { t } from "@/i18n/translations"; import BaseLayout from "./Base.astro"; interface Props { post: CollectionEntry<"post">; + prevPost: CollectionEntry<"post"> | null | undefined; + nextPost: CollectionEntry<"post"> | null | undefined; } -const { post } = Astro.props; +const { post, prevPost, nextPost } = Astro.props; const { ogImage, title, description, updatedDate, publishDate, language } = post.data; const socialImage = ogImage ?? `/og-image/${post.id}.png`; const articleDate = updatedDate?.toISOString() ?? publishDate.toISOString(); @@ -49,6 +52,7 @@ const articleDate = updatedDate?.toISOString() ?? publishDate.toISOString(); } </div> </article> + <PostNavigation prevPost={prevPost} nextPost={nextPost} language={language} /> <button class="hover:border-link fixed end-4 bottom-8 z-90 flex h-10 w-10 translate-y-28 cursor-pointer items-center justify-center rounded-full border-2 border-transparent bg-zinc-200 text-3xl opacity-0 transition-all transition-discrete duration-300 data-[show=true]:translate-y-0 data-[show=true]:opacity-100 sm:end-8 sm:h-12 sm:w-12 dark:bg-zinc-700" data-show="false" |
