feat(seo): add sitemap, RSS feed, and robots.txt

This commit is contained in:
2026-07-25 19:28:13 +02:00
parent b6c2e4f604
commit 0c61483d10
3 changed files with 29 additions and 1 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
import { defineConfig } from 'astro/config';
import preact from '@astrojs/preact';
import sitemap from '@astrojs/sitemap';
// Salida estática pura: HTML/JSON servidos por Caddy, sin proceso Node en
// producción. Los datos se consultan a Postgres una única vez, en build-time
@@ -7,7 +8,7 @@ import preact from '@astrojs/preact';
export default defineConfig({
output: 'static',
site: 'https://www.eivissaenvironmentalwatch.es',
integrations: [preact()],
integrations: [preact(), sitemap()],
build: {
inlineStylesheets: 'always', // menos peticiones = menos energía por visita
},
+4
View File
@@ -0,0 +1,4 @@
User-agent: *
Allow: /
Sitemap: https://www.eivissaenvironmentalwatch.es/sitemap-index.xml
+23
View File
@@ -0,0 +1,23 @@
import rss from '@astrojs/rss';
import type { APIContext } from 'astro';
import { getAvisosAmbientales } from '../lib/db';
export async function GET(context: APIContext) {
const avisos = await getAvisosAmbientales();
return rss({
title: 'Ibiza Environmental Watch',
description:
"Vigilància ambiental d'Eivissa i Formentera: BOIB i premsa local, classificats amb IA local.",
site: context.site ?? 'https://www.eivissaenvironmentalwatch.es',
items: avisos.map((a) => ({
title: a.titulo,
pubDate: new Date(a.fecha),
description: a.resumen,
link: a.url,
categories: a.temas,
author: a.fuente,
})),
customData: '<language>ca-ES</language>',
});
}