diff options
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 +} |
