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
All checks were successful
Deploy to OVH VPS / deploy (push) Successful in 36s
This commit is contained in:
parent
0221009352
commit
57cc101f9e
4 changed files with 108 additions and 236 deletions
|
|
@ -1,234 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title><xsl:value-of select="/rss/channel/title"/> - RSS Feed</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #1f2937;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
padding: 2rem 1rem;
|
||||
}
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
background: white;
|
||||
border-radius: 1rem;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
||||
overflow: hidden;
|
||||
}
|
||||
.header {
|
||||
background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
|
||||
color: white;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
.header h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.header p {
|
||||
font-size: 1.125rem;
|
||||
opacity: 0.9;
|
||||
}
|
||||
.info-box {
|
||||
background: #f3f4f6;
|
||||
border-left: 4px solid #3b82f6;
|
||||
padding: 1.5rem;
|
||||
margin: 2rem;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
.info-box h2 {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
margin-bottom: 0.75rem;
|
||||
color: #1e3a8a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.info-box p {
|
||||
color: #4b5563;
|
||||
line-height: 1.8;
|
||||
}
|
||||
.info-box code {
|
||||
background: white;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 0.25rem;
|
||||
font-family: 'Courier New', monospace;
|
||||
color: #1e3a8a;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
.subscribe-btn {
|
||||
display: inline-block;
|
||||
background: #3b82f6;
|
||||
color: white;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border-radius: 0.5rem;
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
margin-top: 1rem;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
.subscribe-btn:hover {
|
||||
background: #2563eb;
|
||||
}
|
||||
.posts {
|
||||
padding: 2rem;
|
||||
}
|
||||
.posts h2 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 1.5rem;
|
||||
color: #111827;
|
||||
padding-bottom: 0.75rem;
|
||||
border-bottom: 2px solid #e5e7eb;
|
||||
}
|
||||
.post {
|
||||
padding: 1.5rem;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
.post:hover {
|
||||
background: #f9fafb;
|
||||
}
|
||||
.post:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.post-title {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.post-title a {
|
||||
color: #1e3a8a;
|
||||
text-decoration: none;
|
||||
}
|
||||
.post-title a:hover {
|
||||
color: #3b82f6;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.post-meta {
|
||||
color: #6b7280;
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: 0.75rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.post-description {
|
||||
color: #4b5563;
|
||||
line-height: 1.8;
|
||||
}
|
||||
.tag {
|
||||
background: #dbeafe;
|
||||
color: #1e3a8a;
|
||||
padding: 0.25rem 0.75rem;
|
||||
border-radius: 0.375rem;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
.footer {
|
||||
text-align: center;
|
||||
padding: 2rem;
|
||||
background: #f9fafb;
|
||||
color: #6b7280;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
.footer a {
|
||||
color: #3b82f6;
|
||||
text-decoration: none;
|
||||
}
|
||||
.footer a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
body {
|
||||
padding: 1rem;
|
||||
}
|
||||
.header h1 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
.info-box, .posts {
|
||||
padding: 1rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>📡 <xsl:value-of select="/rss/channel/title"/></h1>
|
||||
<p><xsl:value-of select="/rss/channel/description"/></p>
|
||||
</div>
|
||||
|
||||
<div class="info-box">
|
||||
<h2>🎯 What is an RSS Feed?</h2>
|
||||
<p>
|
||||
This is an RSS feed. It allows you to subscribe to updates from this blog using an RSS reader.
|
||||
Copy the URL <code><xsl:value-of select="/rss/channel/link"/>/rss.xml</code> and paste it into your favorite RSS reader to stay updated!
|
||||
</p>
|
||||
<a href="https://aboutfeeds.com/" target="_blank" class="subscribe-btn">Learn More About RSS</a>
|
||||
</div>
|
||||
|
||||
<div class="posts">
|
||||
<h2>Recent Posts (<xsl:value-of select="count(/rss/channel/item)"/>)</h2>
|
||||
<xsl:for-each select="/rss/channel/item">
|
||||
<div class="post">
|
||||
<div class="post-title">
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="link"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="title"/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="post-meta">
|
||||
<span>📅 <xsl:value-of select="substring(pubDate, 0, 17)"/></span>
|
||||
<xsl:if test="author">
|
||||
<span>•</span>
|
||||
<span>✍️ <xsl:value-of select="author"/></span>
|
||||
</xsl:if>
|
||||
<xsl:if test="category">
|
||||
<span>•</span>
|
||||
<xsl:for-each select="category">
|
||||
<span class="tag"><xsl:value-of select="."/></span>
|
||||
</xsl:for-each>
|
||||
</xsl:if>
|
||||
</div>
|
||||
<div class="post-description">
|
||||
<xsl:value-of select="description"/>
|
||||
</div>
|
||||
</div>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<p>
|
||||
Powered by <a href="https://astro.build" target="_blank">Astro</a> •
|
||||
Visit <a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="/rss/channel/link"/>
|
||||
</xsl:attribute>
|
||||
lorenzoiovino.com
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -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
107
src/pages/feed.astro
Normal 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>
|
||||
|
|
@ -23,6 +23,5 @@ export async function GET(context: APIContext) {
|
|||
categories: post.data.tags,
|
||||
})),
|
||||
customData: `<language>en-us</language>`,
|
||||
stylesheet: "/rss-styles.xsl",
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue