feat(seo): add sitemap, RSS feed, and robots.txt
This commit is contained in:
+2
-1
@@ -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
|
||||
},
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
Sitemap: https://www.eivissaenvironmentalwatch.es/sitemap-index.xml
|
||||
@@ -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>',
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user