From a12b3ae671e12b95bb0834d399687ad79cf47c92 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Mon, 30 Mar 2026 18:45:37 +0200 Subject: [PATCH] Add RSS Feed button Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- src/components/Hero.astro | 16 +++++++++++++++- src/config.ts | 4 +++- src/pages/blog/index.astro | 2 -- src/pages/index.astro | 1 + src/pages/rss.xml.ts | 17 ++--------------- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/components/Hero.astro b/src/components/Hero.astro index 379d8ea..746e3d8 100644 --- a/src/components/Hero.astro +++ b/src/components/Hero.astro @@ -1,6 +1,7 @@ --- import { ArrowRight, Coffee, FolderCode, Key, Newspaper } from "@lucide/astro"; import { Image } from "astro:assets"; +import { Rss } from "lucide-astro"; interface Props { name: string; @@ -22,9 +23,10 @@ interface Props { codetips?: string; }; gpgKey?: string; + rssFeed?: string; } -const { name, title, description, avatar, location, socialLinks, gpgKey } = +const { name, title, description, avatar, location, socialLinks, gpgKey, rssFeed } = Astro.props; --- @@ -316,6 +318,18 @@ const { name, title, description, avatar, location, socialLinks, gpgKey } = )} + {rssFeed && ( +
+ + + +
+ )} ) } diff --git a/src/config.ts b/src/config.ts index cf4d716..f7d3dba 100644 --- a/src/config.ts +++ b/src/config.ts @@ -26,6 +26,7 @@ export interface SiteConfig { location: string; socialLinks: SocialLinks; gpgKey?: string; + rssFeed?: string; } /** @@ -34,7 +35,7 @@ export interface SiteConfig { */ export const siteConfig: SiteConfig = { name: "Hadi", - title: "Infosec engineer.", + title: "@anotherhadi - Infosec engineer.", description: "Infosec engineer passionate about Linux/NixOS, blockchains, OSINT & FOSS. Hacking with Go, exploring open tech, and contributing whenever I can 🐧", avatar: "/avatar.png", @@ -49,4 +50,5 @@ export const siteConfig: SiteConfig = { medium: "https://medium.com/@anotherhadi", }, gpgKey: "/anotherhadi.asc", + rssFeed: "https://hadi.icu/rss.xml", }; diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 89c7d00..dc20d81 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -1,8 +1,6 @@ --- import Layout from "../../layouts/Layout.astro"; import { getCollection } from "astro:content"; -import { Image } from "astro:assets"; -import TagBadge from "../../components/TagBadge.astro"; import { ChevronLeft } from "@lucide/astro"; import BlogCard from "../../components/BlogCard.astro"; diff --git a/src/pages/index.astro b/src/pages/index.astro index 19104f1..0bba479 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -18,6 +18,7 @@ import avatar from "../../public/avatar.jpg"; location={siteConfig.location} socialLinks={siteConfig.socialLinks} gpgKey={siteConfig.gpgKey} + rssFeed={siteConfig.rssFeed} /> diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index 68b6de1..270149e 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -4,7 +4,6 @@ import type { APIContext } from "astro"; export async function GET(context: APIContext) { const blog = await getCollection("blog"); - const projects = await getCollection("projects"); const blogItems = blog.map((post) => ({ title: post.data.title, @@ -18,24 +17,12 @@ export async function GET(context: APIContext) { }, })); - const projectItems = projects.map((project) => ({ - title: `[Project] ${project.data.title}`, - pubDate: new Date(), - description: project.data.description, - link: `/projects/${project.id}/`, - enclosure: { - url: new URL(project.data.image.src, context.site).toString(), - length: 0, - type: "image/png", - }, - })); - - const allItems = [...blogItems, ...projectItems].sort( + const allItems = [...blogItems].sort( (a, b) => b.pubDate.getTime() - a.pubDate.getTime(), ); return rss({ - title: "Another Hadi", + title: "Another Hadi - Blog posts", description: "Thoughts, insights, and tutorials on cybersecurity, OSINT, and technology.", site: context.site!,