mirror of
https://github.com/anotherhadi/blog.git
synced 2026-05-20 21:42:33 +02:00
Add RSS Feed button
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -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";
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import avatar from "../../public/avatar.jpg";
|
||||
location={siteConfig.location}
|
||||
socialLinks={siteConfig.socialLinks}
|
||||
gpgKey={siteConfig.gpgKey}
|
||||
rssFeed={siteConfig.rssFeed}
|
||||
/>
|
||||
|
||||
<Blog />
|
||||
|
||||
+2
-15
@@ -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!,
|
||||
|
||||
Reference in New Issue
Block a user