diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-21 21:56:55 +0300 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-21 21:56:55 +0300 |
| commit | c735556726e75428550a3d28a2cf58e2c8490b7d (patch) | |
| tree | fd0ae29d1636b825abeedff6b99d3376bb383135 /src/components/blog/RelatedPosts.astro | |
Initial template
Diffstat (limited to 'src/components/blog/RelatedPosts.astro')
| -rw-r--r-- | src/components/blog/RelatedPosts.astro | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/components/blog/RelatedPosts.astro b/src/components/blog/RelatedPosts.astro new file mode 100644 index 0000000..f4036e9 --- /dev/null +++ b/src/components/blog/RelatedPosts.astro @@ -0,0 +1,31 @@ +--- +import { APP_BLOG } from 'astrowind:config'; + +import { getRelatedPosts } from '~/utils/blog'; +import BlogHighlightedPosts from '../widgets/BlogHighlightedPosts.astro'; +import type { Post } from '~/types'; +import { getBlogPermalink } from '~/utils/permalinks'; + +export interface Props { + post: Post; +} + +const { post } = Astro.props; + +const relatedPosts = post.tags ? await getRelatedPosts(post, 4) : []; +--- + +{ + APP_BLOG.isRelatedPostsEnabled ? ( + <BlogHighlightedPosts + classes={{ + container: + 'pt-0 lg:pt-0 md:pt-0 intersect-once intersect-quarter motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade', + }} + title="Related Posts" + linkText="View All Posts" + linkUrl={getBlogPermalink()} + postIds={relatedPosts.map((post) => post.id)} + /> + ) : null +} |
