Astro Test Blog
Image by Jordi, Made with AI

π Astro Test Blog
This is a test blog built with Astro, designed to explore Astroβs capabilities for content-driven websites. The blog supports Markdown/MDX-based posts, a dynamic routing system, and RSS feed generation.
π Features
- π Markdown & MDX Support β Write posts in
.md
or.mdx
format. - π Dynamic Routing β Blog posts are generated dynamically from the
/posts
directory. - π¨ Custom Layouts β Uses
MainLayout.astro
andBlogLayout.astro
for a structured content experience. - π± RSS Feed Integration β Easily generate an RSS feed for blog syndication.
- π Dark Mode Ready β Styled with a sleek, modern dark theme.
ποΈ Project Structure
/src
βββ /assets # Static assets (icons, background images, post images)
β βββ astro.svg
β βββ background.svg
β βββ post-01.png
β βββ post-02.png
β βββ post-03.png
β βββ post-04.png
β βββ post-05.png
β
βββ /components # Reusable UI components for blog posts
β βββ BlogPost.astro # Individual blog post preview component
β βββ TypeBlogPost.astro # Handles blog post previews dynamically
β βββ Welcome.astro # Welcome component with introductory info
β
βββ /config
β βββ site-config.ts # Configuration file for site settings
β
βββ /content
β βββ /blog # Blog content storage
β βββ config.ts # Blog settings configuration
β
βββ /layouts # Layout components for pages and posts
β βββ BlogLayout.astro # Layout for individual blog posts
β βββ MainLayout.astro # Base layout for the website
β
βββ /pages # Astro pages
β βββ /images # Folder for storing images (if needed)
β βββ /posts # Active blog posts
β βββ /posts-old # Archive for old blog posts
β βββ blog-file-system.astro # Blog page displaying posts
β βββ index.astro # Homepage listing all blog posts
β
βββ /styles
β βββ blog.css # Custom styling for blog pages
β
βββ /utils
β βββ formatter.ts # Utility for formatting dates
π Getting Started
1οΈβ£ Install Dependencies
Make sure you have Node.js installed, then run:
npm install
2οΈβ£ Run the Blog Locally
Start the Astro development server:
npm run dev
This will launch the blog at http://localhost:4321
(or another port if already in use).
π± RSS Feed Setup
This blog supports RSS feed generation, allowing users to subscribe via feed readers.
How to Generate an RSS Feed
-
Install the RSS Plugin (if not installed)
npm install @astro/rss
-
Create an RSS Feed File Add an
rss.xml.js
file inside/pages/api
(or similar):import rss from '@astro/rss'; import { getCollection } from 'astro:content'; export async function get() { const posts = await getCollection('blog'); return rss({ title: "Jordi's Blog", description: "A test blog powered by Astro", site: "https://yourblogdomain.com", items: posts.map((post) => ({ title: post.data.title, link: `/posts/${post.slug}`, pubDate: new Date(post.data.date), description: post.data.description, })), }); }
-
Access the RSS Feed Once deployed, your RSS feed will be available at:
https://yourblogdomain.com/rss.xml
Users can subscribe by adding this URL to their feed reader.
π― Deployment
Deploy your Astro blog using Netlify, Vercel, or GitHub Pages.
Netlify
- Connect your GitHub repo to Netlify.
- Set the build command:
npm run build
- Set the publish directory to
dist/
. - Deploy π.
Vercel
- Install the Vercel CLI:
npm install -g vercel
- Deploy:
vercel
Your blog will be live instantly! πβ¨
π Notes
- Make sure your
astro.config.mjs
is configured to support RSS feeds. - To add new blog posts, create
.md
or.mdx
files inside/posts
. - Ensure
astro:content
is properly set up to fetch and render blog posts.
-
API and Pokemon
-
Creating Peachjarβs Help Center
-
Astro: Lessons & Wins
-
Twitter Mention bot
-
Astro Test Blog
-
Hubspot-Modules
-
HubSpot-Module-RichText
Related:
Written by

Jordi Comas
Senior Technical Writer
Industrial Designer