Skip to content

Blog Components

Blog components are designed for article pages and blog listings.

Displays the article header with title, metadata, and optional cover image:

---
import ArticleHero from '@/components/blog/ArticleHero.astro';
---
<ArticleHero
title="Getting Started with Velocity"
publishedAt={new Date('2026-01-28')}
author="John Doe"
image="/blog/velocity-intro.jpg"
imageAlt="Velocity documentation"
/>
PropTypeDescription
titlestringArticle title
publishedAtDatePublication date
updatedAtDateLast updated (optional)
authorstringAuthor name
imagestringCover image URL
imageAltstringCover image alt text
tagsstring[]Article tags

Card for blog listings:

---
import BlogCard from '@/components/blog/BlogCard.astro';
---
<BlogCard
title="Article Title"
description="Brief description of the article"
href="/blog/article-slug"
image="/blog/thumbnail.jpg"
publishedAt={new Date('2026-01-28')}
author="John Doe"
/>
PropTypeDescription
titlestringArticle title
descriptionstringArticle excerpt
hrefstringArticle URL
imagestringThumbnail image
publishedAtDatePublication date
authorstringAuthor name
tagsstring[]Article tags

Social sharing buttons:

---
import ShareButtons from '@/components/blog/ShareButtons.astro';
---
<ShareButtons
url={Astro.url.href}
title="Article Title"
/>
  • Twitter sharing
  • Facebook sharing
  • LinkedIn sharing
  • Copy link button

Shows related articles based on tags:

---
import RelatedPosts from '@/components/blog/RelatedPosts.astro';
---
<RelatedPosts
currentSlug="current-article"
tags={['astro', 'tutorial']}
limit={3}
/>
PropTypeDefaultDescription
currentSlugstringCurrent article slug
tagsstring[][]Tags to match
limitnumber3Max related posts
---
import { getCollection } from 'astro:content';
import BlogCard from '@/components/blog/BlogCard.astro';
const posts = await getCollection('blog');
const sortedPosts = posts.sort((a, b) =>
b.data.publishedAt.valueOf() - a.data.publishedAt.valueOf()
);
---
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
{sortedPosts.map((post) => (
<BlogCard
title={post.data.title}
description={post.data.description}
href={`/blog/${post.id}`}
image={post.data.image}
publishedAt={post.data.publishedAt}
author={post.data.author}
/>
))}
</div>
<footer class="mt-12 pt-8 border-t border-border">
<ShareButtons url={Astro.url.href} title={title} />
<div class="mt-12">
<h2 class="text-2xl font-bold mb-6">Related Articles</h2>
<RelatedPosts currentSlug={slug} tags={tags} />
</div>
</footer>