feat: il feed RSS non usa piu' XSLT, pagina /feed vera e URL del feed corretto
All checks were successful
Deploy to OVH VPS / deploy (push) Successful in 36s

This commit is contained in:
Lorenzo Iovino 2026-11-26 10:00:24 +01:00
parent 0221009352
commit 57cc101f9e
4 changed files with 108 additions and 236 deletions

View file

@ -18,7 +18,7 @@ const maxWidth = width === "7xl" ? "max-w-7xl" : "max-w-4xl";
>
<div class="flex flex-wrap items-center gap-1 md:gap-3 text-xs">
<a
href="/rss.xml"
href="/feed"
class="transition-colors duration-200 inline-flex items-center gap-1 hover:text-gray-600 dark:hover:text-gray-300"
title="RSS Feed"
>

107
src/pages/feed.astro Normal file
View file

@ -0,0 +1,107 @@
---
import type { CollectionEntry } from "astro:content";
import { getCollection } from "astro:content";
import { isPublished } from "../utils/posts";
import Footer from "../components/Footer.astro";
import Navbar from "../components/Navbar.astro";
import BaseLayout from "../layouts/BaseLayout.astro";
type BlogPost = CollectionEntry<"blog">;
const FEED_URL = "https://lorenzoiovino.com/rss.xml";
const allPosts: BlogPost[] = await getCollection("blog");
const posts: BlogPost[] = allPosts
.filter((post: BlogPost) => isPublished(post))
.sort((a: BlogPost, b: BlogPost) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
---
<BaseLayout
title="Lorenzo Iovino >> RSS Feed"
description="Subscribe to Lorenzo Iovino's blog with your favorite RSS reader"
>
<Navbar />
<div class="min-h-screen pt-16 bg-secondary dark:bg-gray-900 transition-colors duration-200">
<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12 md:py-20">
<div class="mb-12 text-center">
<h1 class="text-gray-800 dark:text-gray-100 mb-4 pb-2">RSS Feed</h1>
<p class="text-xl text-gray-800/90 dark:text-gray-300 max-w-2xl mx-auto">
Follow the blog with your favorite feed reader
</p>
<div class="h-1 w-20 bg-gray-800 dark:bg-primary rounded-full mx-auto mt-6"></div>
</div>
<div
class="bg-white dark:bg-gray-800 rounded-2xl shadow-soft-lg p-6 md:p-8 mb-12 transition-colors duration-200"
>
<h2 class="text-xl font-bold text-gray-900 dark:text-gray-100 mb-3">What is an RSS Feed?</h2>
<p class="text-gray-700 dark:text-gray-300 leading-relaxed mb-4">
This is a feed you can subscribe to in a feed reader. Copy the URL below into your reader
and new posts will show up there as soon as they are published.
</p>
<code
class="block break-all px-4 py-3 mb-4 bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-100 rounded-lg text-sm"
>{FEED_URL}</code
>
<div class="flex flex-wrap gap-4 font-medium">
<a
href="/rss.xml"
class="text-secondary-700 dark:text-primary hover:underline">Open the raw feed</a
>
<a
href="https://aboutfeeds.com/"
target="_blank"
rel="noopener"
class="text-secondary-700 dark:text-primary hover:underline">Learn more about RSS</a
>
</div>
</div>
<h2 class="text-2xl font-bold text-gray-800 dark:text-gray-100 mb-6">
Recent Posts ({posts.length})
</h2>
<div class="space-y-4">
{
posts.map((post: BlogPost) => (
<article class="bg-white dark:bg-gray-800 rounded-2xl shadow-soft-lg p-6 transition-colors duration-200">
<div class="flex items-center gap-3 mb-2 text-sm text-gray-500 dark:text-gray-400 flex-wrap">
<time datetime={post.data.pubDate.toISOString()}>
{post.data.pubDate.toLocaleDateString("en-US", {
year: "numeric",
month: "long",
day: "numeric",
})}
</time>
{post.data.tags.length > 0 && (
<>
<span>•</span>
<div class="flex gap-2 flex-wrap">
{post.data.tags.map((tag: string) => (
<a
href={`/blog/tag/${tag}`}
class="px-2 py-1 bg-secondary/10 dark:bg-primary/20 text-gray-800 dark:text-gray-200 text-xs rounded-lg font-medium hover:bg-secondary hover:text-white dark:hover:bg-primary dark:hover:text-gray-900 transition-all duration-200"
>
{tag}
</a>
))}
</div>
</>
)}
</div>
<h3 class="text-lg md:text-xl font-bold mb-1">
<a
href={`/blog/${post.slug}`}
class="text-gray-900 dark:text-gray-100 hover:text-secondary-700 dark:hover:text-primary transition-colors"
>
{post.data.title}
</a>
</h3>
<p class="text-gray-700 dark:text-gray-300 leading-relaxed">{post.data.description}</p>
</article>
))
}
</div>
</div>
</div>
<Footer />
</BaseLayout>

View file

@ -23,6 +23,5 @@ export async function GET(context: APIContext) {
categories: post.data.tags,
})),
customData: `<language>en-us</language>`,
stylesheet: "/rss-styles.xsl",
});
}